Skip to content

Commit 1fb82a5

Browse files
Merge pull request #3899 from dotty-staging/fix-#2671
Fix #2671: Don't instantiate typevars before creating implicit closure
2 parents 0c1ae4e + fc225ff commit 1fb82a5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,8 +1779,7 @@ class Typer extends Namer
17791779

17801780
protected def makeImplicitFunction(tree: untpd.Tree, pt: Type)(implicit ctx: Context): Tree = {
17811781
val defn.FunctionOf(formals, _, true) = pt.dropDependentRefinement
1782-
val paramTypes = formals.map(fullyDefinedType(_, "implicit function parameter", tree.pos))
1783-
val ifun = desugar.makeImplicitFunction(paramTypes, tree)
1782+
val ifun = desugar.makeImplicitFunction(formals, tree)
17841783
typr.println(i"make implicit function $tree / $pt ---> $ifun")
17851784
typed(ifun, pt)
17861785
}

tests/pos/i2671.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object Foo {
2+
3+
def map[E](f: implicit E => Int): (implicit E => Int) = ???
4+
5+
implicit def i: Int = ???
6+
7+
def f: implicit Int => Int = ???
8+
9+
val a: Int = map(f)
10+
11+
}

0 commit comments

Comments
 (0)