Skip to content

Commit

Permalink
Fix overloading resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Sporarum committed Jan 19, 2022
1 parent 7fb40c2 commit e765617
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/Printers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object Printers {
val interactiv = noPrinter
val matchTypes = noPrinter
val nullables = noPrinter
val overload = default
val overload = noPrinter
val patmatch = noPrinter
val pickling = noPrinter
val quotePickling = noPrinter
Expand Down
19 changes: 12 additions & 7 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,18 @@ trait Applications extends Compatibility {
/** The function's type after widening and instantiating polytypes
* with TypeParamRefs in constraint set
*/
@threadUnsafe lazy val methType: Type = liftedFunType.widen match {
case funType: MethodType => funType
case funType: PolyType => instantiateWithTypeVars(funType)
case tp => tp //was: funType
@threadUnsafe lazy val methType: Type = {
def rec(t: Type): Type = {
t.widen match{
case funType: MethodType => funType
case funType: PolyType =>
//rec(constrained(funType).resultType) //TODO: Could replace rec(etc) by etc.methType ?
rec(instantiateWithTypeVars(funType))
case tp => tp
}
}

rec(liftedFunType)
}

@threadUnsafe lazy val liftedFunType: Type =
Expand Down Expand Up @@ -692,11 +700,8 @@ trait Applications extends Compatibility {
final def addArg(arg: TypedArg, formal: Type): Unit = ok = ok & argOK(arg, formal)
def makeVarArg(n: Int, elemFormal: Type): Unit = {}
def fail(msg: Message, arg: Arg): Unit =
//println(msg)
//println(arg)
ok = false
def fail(msg: Message): Unit =
//println(msg)
ok = false
def appPos: SrcPos = NoSourcePosition
@threadUnsafe lazy val normalizedFun: Tree = ref(methRef)
Expand Down

0 comments on commit e765617

Please sign in to comment.