File tree 2 files changed +25
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -2551,9 +2551,17 @@ class Typer extends Namer
2551
2551
missingArgs(wtp)
2552
2552
}
2553
2553
2554
+ def isImplicitFunctionRef (wtp : Type ): Boolean = wtp match {
2555
+ case RefinedType (parent, nme.apply, _) =>
2556
+ isImplicitFunctionRef(parent) // apply refinements indicate a dependent IFT
2557
+ case _ =>
2558
+ val underlying = wtp.underlyingClassRef(refinementOK = false ) // other refinements are not OK
2559
+ defn.isImplicitFunctionClass(underlying.classSymbol)
2560
+ }
2561
+
2554
2562
def adaptNoArgsOther (wtp : Type ): Tree = {
2555
2563
ctx.typeComparer.GADTused = false
2556
- if (defn.isImplicitFunctionClass (wtp.underlyingClassRef(refinementOK = false ).classSymbol ) &&
2564
+ if (isImplicitFunctionRef (wtp) &&
2557
2565
! untpd.isContextualClosure(tree) &&
2558
2566
! isApplyProto(pt) &&
2559
2567
! ctx.mode.is(Mode .Pattern ) &&
Original file line number Diff line number Diff line change
1
+ object Dependent {
2
+ def x : given (i : Int ) => Int = ???
3
+ def y : given (i : Int ) => Int = x
4
+ }
5
+ object Independent {
6
+ def x : given Int => Int = ???
7
+ def y : given Int => Int = x
8
+ }
9
+ object NarrowDependent {
10
+ def x : given Int => Int = ???
11
+ def y : given (i : Int ) => Int = x
12
+ }
13
+ object WidenDependent {
14
+ def x : given (i : Int ) => Int = ???
15
+ def y : given Int => Int = x
16
+ }
You can’t perform that action at this time.
0 commit comments