Skip to content

Commit c917cf8

Browse files
authored
Merge pull request #3728 from dotty-staging/fix-#3537
Fix #3537: Don't add an implicit to qualifier of constructor
2 parents 6c75415 + 3487139 commit c917cf8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19121912
*/
19131913
def tryInsertImplicitOnQualifier(tree: Tree, pt: Type)(implicit ctx: Context): Option[Tree] = trace(i"try insert impl on qualifier $tree $pt") {
19141914
tree match {
1915-
case Select(qual, name) =>
1915+
case Select(qual, name) if name != nme.CONSTRUCTOR =>
19161916
val qualProto = SelectionProto(name, pt, NoViewsAllowed, privateOK = false)
19171917
tryEither { implicit ctx =>
19181918
val qual1 = adaptInterpolated(qual, qualProto)

tests/neg/i3537.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import dotty.Show._
2+
3+
class Foo(x: Int)
4+
5+
object Test {
6+
val res0 = new Foo("Hello") // error
7+
}

0 commit comments

Comments
 (0)