Skip to content

Commit cd9a29f

Browse files
committed
Support multiple implicit parameter lists
1 parent 8b8d813 commit cd9a29f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,11 +1378,11 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
13781378
}
13791379

13801380
/** Drop any implicit parameter section */
1381-
def stripImplicit(tp: Type, weight: Int): Type = tp match {
1381+
def stripImplicit(tp: Type): Type = tp match {
13821382
case mt: MethodType if mt.isImplicitMethod =>
1383-
resultTypeApprox(mt)
1383+
stripImplicit(resultTypeApprox(mt))
13841384
case pt: PolyType =>
1385-
pt.derivedLambdaType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType, weight))
1385+
pt.derivedLambdaType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType))
13861386
case _ =>
13871387
tp
13881388
}
@@ -1408,8 +1408,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
14081408

14091409
val fullType1 = widenImplied(alt1.widen, alt1)
14101410
val fullType2 = widenImplied(alt2.widen, alt2)
1411-
val strippedType1 = stripImplicit(fullType1, -1)
1412-
val strippedType2 = stripImplicit(fullType2, +1)
1411+
val strippedType1 = stripImplicit(fullType1)
1412+
val strippedType2 = stripImplicit(fullType2)
14131413

14141414
val result = compareWithTypes(strippedType1, strippedType2)
14151415
if (result != 0) result

tests/run/implied-specifity-2.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ object Baz {
2929
implied baz given High for Foo[Bar[Baz]](5)
3030
}
3131

32+
class Arg
33+
implied for Arg
34+
35+
class Bam(val str: String)
36+
implied lo given Low for Bam("lo")
37+
implied hi given High given Arg for Bam("hi")
38+
3239
object Test extends App {
3340
assert(Foo[Int] == 0)
3441
assert(Foo[Bar[Int]] == 3)
3542
assert(Foo[Bar[Baz]] == 5)
43+
assert(the[Bam].str == "hi")
3644
}

0 commit comments

Comments
 (0)