Skip to content

Commit e765617

Browse files
committed
Fix overloading resolution
1 parent 7fb40c2 commit e765617

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

compiler/src/dotty/tools/dotc/config/Printers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object Printers {
3333
val interactiv = noPrinter
3434
val matchTypes = noPrinter
3535
val nullables = noPrinter
36-
val overload = default
36+
val overload = noPrinter
3737
val patmatch = noPrinter
3838
val pickling = noPrinter
3939
val quotePickling = noPrinter

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,18 @@ trait Applications extends Compatibility {
411411
/** The function's type after widening and instantiating polytypes
412412
* with TypeParamRefs in constraint set
413413
*/
414-
@threadUnsafe lazy val methType: Type = liftedFunType.widen match {
415-
case funType: MethodType => funType
416-
case funType: PolyType => instantiateWithTypeVars(funType)
417-
case tp => tp //was: funType
414+
@threadUnsafe lazy val methType: Type = {
415+
def rec(t: Type): Type = {
416+
t.widen match{
417+
case funType: MethodType => funType
418+
case funType: PolyType =>
419+
//rec(constrained(funType).resultType) //TODO: Could replace rec(etc) by etc.methType ?
420+
rec(instantiateWithTypeVars(funType))
421+
case tp => tp
422+
}
423+
}
424+
425+
rec(liftedFunType)
418426
}
419427

420428
@threadUnsafe lazy val liftedFunType: Type =
@@ -692,11 +700,8 @@ trait Applications extends Compatibility {
692700
final def addArg(arg: TypedArg, formal: Type): Unit = ok = ok & argOK(arg, formal)
693701
def makeVarArg(n: Int, elemFormal: Type): Unit = {}
694702
def fail(msg: Message, arg: Arg): Unit =
695-
//println(msg)
696-
//println(arg)
697703
ok = false
698704
def fail(msg: Message): Unit =
699-
//println(msg)
700705
ok = false
701706
def appPos: SrcPos = NoSourcePosition
702707
@threadUnsafe lazy val normalizedFun: Tree = ref(methRef)

0 commit comments

Comments
 (0)