Skip to content

Commit 99cd405

Browse files
committed
Fix #4582: use untpd.New in maybeCall
1 parent e74fd6c commit 99cd405

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-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
@@ -1475,8 +1475,7 @@ class Typer extends Namer
14751475
*/
14761476
def maybeCall(ref: Tree, psym: Symbol, cinfo: Type): Tree = cinfo.stripPoly match {
14771477
case cinfo @ MethodType(Nil) if cinfo.resultType.isImplicitMethod =>
1478-
val icall = New(ref).select(nme.CONSTRUCTOR).appliedToNone
1479-
typedExpr(untpd.TypedSplice(icall))(superCtx)
1478+
typedExpr(untpd.New(ref, Nil))(superCtx)
14801479
case cinfo @ MethodType(Nil) if !cinfo.resultType.isInstanceOf[MethodType] =>
14811480
ref
14821481
case cinfo: MethodType =>

tests/pos/i4582.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
trait T[A: Numeric]
2+
class TX[A: Numeric] extends T[A]
3+
class TY[A: Numeric] extends T[A]()
4+
5+
trait S[A: Numeric](x: Int)
6+
class SX[A: Numeric] extends S[A](0)

0 commit comments

Comments
 (0)