File tree 3 files changed +27
-1
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ object Implicits {
60
60
61
61
/** Return those references in `refs` that are compatible with type `pt`. */
62
62
protected def filterMatching (pt : Type )(implicit ctx : Context ): List [Candidate ] = track(" filterMatching" ) {
63
+ val ptNorm = normalize(pt, pt) // `pt` could be implicit function types, check i2749
63
64
64
65
def refMatches (ref : TermRef )(implicit ctx : Context ) = /* ctx.traceIndented(i"refMatches $ref $pt")*/ {
65
66
@@ -123,7 +124,8 @@ object Implicits {
123
124
record(" discarded eligible" )
124
125
false
125
126
}
126
- else NoViewsAllowed .isCompatible(normalize(ref, pt), pt)
127
+ else
128
+ NoViewsAllowed .isCompatible(normalize(ref, pt), ptNorm)
127
129
}
128
130
}
129
131
Original file line number Diff line number Diff line change @@ -1655,6 +1655,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1655
1655
if (defn.isImplicitFunctionType(pt) &&
1656
1656
xtree.isTerm &&
1657
1657
! untpd.isImplicitClosure(xtree) &&
1658
+ ! ctx.mode.is(Mode .ImplicitShadowing ) &&
1658
1659
! ctx.isAfterTyper)
1659
1660
makeImplicitFunction(xtree, pt)
1660
1661
else xtree match {
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ val f : implicit (implicit Int => Char ) => Boolean = ???
3
+ implicit val n : Int = 3
4
+ implicit val g : implicit Int => Char = ???
5
+
6
+ f : Boolean
7
+ }
8
+
9
+ object Test2 {
10
+ val f : implicit (implicit Int => Char ) => Boolean = ???
11
+ implicit val s : String = null
12
+ implicit val g : implicit Int => implicit String => Char = ???
13
+
14
+ f : Boolean
15
+ }
16
+
17
+ object Test3 {
18
+ val f : implicit (implicit Int => implicit String => Char ) => Boolean = ???
19
+ implicit val n : Int = 3
20
+ implicit val g : implicit Int => Char = ???
21
+
22
+ f : Boolean
23
+ }
You can’t perform that action at this time.
0 commit comments