File tree Expand file tree Collapse file tree 3 files changed +42
-3
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ object Inferencing {
141
141
if (toTest.isEmpty) acc
142
142
else tree match {
143
143
case Apply (fn, _) =>
144
- fn.tpe match {
144
+ fn.tpe.widen match {
145
145
case mtp : MethodType =>
146
146
val (occ, nocc) = toTest.partition(tvar => mtp.paramTypes.exists(tvar.occursIn))
147
147
occurring(fn, nocc, occ ::: acc)
Original file line number Diff line number Diff line change @@ -563,7 +563,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
563
563
val pos = params indexWhere (_.name == param.name)
564
564
if (pos < mtpe.paramTypes.length) {
565
565
val ptype = mtpe.paramTypes(pos)
566
- if (isFullyDefined(ptype, ForceDegree .none )) return ptype
566
+ if (isFullyDefined(ptype, ForceDegree .noBottom )) return ptype
567
567
}
568
568
case _ =>
569
569
}
@@ -1265,7 +1265,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1265
1265
1266
1266
def adapt (tree : Tree , pt : Type , original : untpd.Tree = untpd.EmptyTree )(implicit ctx : Context ) = /* >|>*/ track(" adapt" ) /* <|<*/ {
1267
1267
/* >|>*/ ctx.traceIndented(i " adapting $tree of type ${tree.tpe} to $pt" , typr, show = true ) /* <|<*/ {
1268
- interpolateUndetVars(tree, if (tree.isDef) tree.symbol else NoSymbol )
1268
+ if (tree.isDef) interpolateUndetVars(tree, tree.symbol)
1269
+ else if (! tree.tpe.widen.isInstanceOf [MethodOrPoly ]) interpolateUndetVars(tree, NoSymbol )
1269
1270
tree.overwriteType(tree.tpe.simplified)
1270
1271
adaptInterpolated(tree, pt, original)
1271
1272
}
Original file line number Diff line number Diff line change
1
+ class HasFoo [T ] {
2
+ val x : Foo [T ] = ???
3
+ }
4
+ class Foo [T ] {
5
+ def get (x : T ): T = x
6
+ def get2 (x : T ): Nothing = ???
7
+
8
+ def foo1 (x : T )(implicit ev : T ): Nothing = ???
9
+ def foo2 (x : T )(implicit ev : T ): T = ???
10
+ def foo3 [Dummy ](x : T )(implicit ev : T ): Nothing = ???
11
+ def foo4 [Dummy ](x : T )(implicit ev : T ): T = ???
12
+ }
13
+
14
+ object Test {
15
+
16
+ def foo1 [T ](x : T )(implicit ev : T ): Nothing = ???
17
+ def foo2 [T ](x : T )(implicit ev : T ): T = ???
18
+
19
+ def test1 : Unit = {
20
+ implicit val ii : Int = 42
21
+
22
+ foo1(10 )
23
+ foo2(10 )
24
+ }
25
+
26
+ def hf [T ]: HasFoo [T ] = ???
27
+ def test2 : Unit = {
28
+ implicit val ii : Int = 42
29
+
30
+ hf.x.get(10 )
31
+ hf.x.get2(10 )
32
+
33
+ hf.x.foo1(10 )
34
+ hf.x.foo2(10 )
35
+ hf.x.foo3(10 )
36
+ hf.x.foo4(10 )
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments