File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
compiler/src/dotty/tools/dotc/cc Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,12 @@ object Existential:
315
315
case t @ CapturingType (parent, refs : CaptureSet .Var ) =>
316
316
if variance > 0 then needsWrap = true
317
317
super .mapOver(t)
318
+ case defn.FunctionNOf (args, res, contextual) if t.typeSymbol.name.isImpureFunction =>
319
+ if variance > 0 then
320
+ needsWrap = true
321
+ super .mapOver:
322
+ defn.FunctionNOf (args, res, contextual).capturing(boundVar.singletonCaptureSet)
323
+ else mapOver(t)
318
324
case _ =>
319
325
mapOver(t)
320
326
// .showing(i"mapcap $t = $result")
@@ -341,6 +347,7 @@ object Existential:
341
347
case res : MethodType => mapFunOrMethod(res, res.paramInfos, res.resType)
342
348
case res : PolyType => mapFunOrMethod(res, Nil , res.resType) // TODO: Also map bounds of PolyTypes
343
349
case _ => mapCap(apply(res), fail)
350
+ // .showing(i"map cap res $res / ${apply(res)} of $tp = $result")
344
351
tp.derivedFunctionOrMethod(args1, res1)
345
352
346
353
def apply (t : Type ): Type = t match
Original file line number Diff line number Diff line change 68
68
-- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:36:25 -----------------------------------------------
69
69
36 | val _: A^ => C^ => C = y4 // error
70
70
| ^^
71
- | Found: (y4 : A^ => C^ => (ex$52: caps.Exists) -> C^{ex$52})
72
- | Required: A^ => C^ => C
71
+ | Found: (y4 : A^ => (ex$53: caps.Exists) -> C^ ->{ex$53} (ex$52: caps.Exists) -> C^{ex$52})
72
+ | Required: A^ => (ex$56: caps.Exists) -> C^ ->{ex$56} C
73
73
|
74
74
| longer explanation available when compiling with `-explain`
75
75
-- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:39:30 -----------------------------------------------
76
76
39 | val _: A^ => (x: C^) -> C = y5 // error
77
77
| ^^
78
- | Found: (y5 : A^ => (ex$60 : caps.Exists) -> Fun[C^{ex$60 }])
78
+ | Found: (y5 : A^ => (ex$58 : caps.Exists) -> Fun[C^{ex$58 }])
79
79
| Required: A^ => (x: C^) -> C
80
80
|
81
81
| longer explanation available when compiling with `-explain`
82
82
-- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:42:30 -----------------------------------------------
83
83
42 | val _: A^ => (x: C^) => C = y6 // error
84
84
| ^^
85
- | Found: (y6 : A^ => (ex$66 : caps.Exists) -> IFun[C^{ex$66 }])
86
- | Required: A^ => (ex$69 : caps.Exists) -> (x: C^) ->{ex$69 } C
85
+ | Found: (y6 : A^ => (ex$64 : caps.Exists) -> IFun[C^{ex$64 }])
86
+ | Required: A^ => (ex$67 : caps.Exists) -> (x: C^) ->{ex$67 } C
87
87
|
88
88
| longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change @@ -44,4 +44,3 @@ def Test =
44
44
val z1 : A ^ => Array [C ^ ] = ??? // error
45
45
46
46
47
-
You can’t perform that action at this time.
0 commit comments