File tree 4 files changed +18
-3
lines changed
compiler/src/dotty/tools/dotc
4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
518
518
case tp1 : MethodOrPoly =>
519
519
(tp1.signature consistentParams tp2.signature) &&
520
520
matchingParams(tp1, tp2) &&
521
- tp1 .isImplicitMethod == tp2 .isImplicitMethod &&
521
+ ( ! tp2 .isImplicitMethod || tp1 .isImplicitMethod) &&
522
522
isSubType(tp1.resultType, tp2.resultType.subst(tp2, tp1))
523
523
case _ =>
524
524
false
Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ object ProtoTypes {
470
470
normalize(et.resultType, pt)
471
471
case wtp =>
472
472
val iftp = defn.asImplicitFunctionType(wtp)
473
- if (iftp.exists) normalize(iftp.argInfos.last, pt) else tp
473
+ if (iftp.exists) normalize(iftp.dropDependentRefinement. argInfos.last, pt) else tp
474
474
}
475
475
}
476
476
Original file line number Diff line number Diff line change 1
1
object test1 {
2
2
class C [A ] { def foo (a : A ) = " c" }
3
- class D extends C [String ] { override def foo (implicit s : String ) = " d" } // error
3
+ class D extends C [String ] { override def foo (implicit s : String ) = " d" } // used to be error, now ok
4
4
}
5
5
6
6
object test2 {
Original file line number Diff line number Diff line change
1
+ class C { type T }
2
+
3
+ object Main {
4
+
5
+ // val a: implicit Int => Int = implicit (x: Int) => x
6
+ // val b: Int => Int = a
7
+
8
+ def main (args : Array [String ]): Unit = {
9
+ val choose : implicit (c : C ) => Set [Int ] = Set .empty
10
+ val b0 : (C ) => Set [Int ] = choose
11
+ val b1 : (c : C ) => Set [Int ] = choose
12
+ def applyF (f : (c : C ) => Set [Int ]) = f(new C {type T = Int })
13
+ // applyF(choose)
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments