Skip to content

Commit

Permalink
SI-3761: Overload resolution fails on by-name parameter (amended per …
Browse files Browse the repository at this point in the history
…lrytz)

Lukas noted the stopgap at methTypeArgs isn't needed. What! No black tie formals.
  • Loading branch information
som-snytt committed May 22, 2012
1 parent f6a4d94 commit 8de2caa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Expand Up @@ -694,8 +694,7 @@ trait Infer {
isCompatibleArgs(argtpes, formals) && isWeaklyCompatible(restpe, pt) isCompatibleArgs(argtpes, formals) && isWeaklyCompatible(restpe, pt)
} else { } else {
try { try {
val blackTie = formalTypes(params map { _.tpe }, argtpes0.length) val AdjustedTypeArgs.Undets(okparams, okargs, leftUndet) = methTypeArgs(undetparams, formals, restpe, argtpes, pt)
val AdjustedTypeArgs.Undets(okparams, okargs, leftUndet) = methTypeArgs(undetparams, blackTie, restpe, argtpes, pt)
// #2665: must use weak conformance, not regular one (follow the monomorphic case above) // #2665: must use weak conformance, not regular one (follow the monomorphic case above)
(exprTypeArgs(leftUndet, restpe.instantiateTypeParams(okparams, okargs), pt, useWeaklyCompatible = true)._1 ne null) && (exprTypeArgs(leftUndet, restpe.instantiateTypeParams(okparams, okargs), pt, useWeaklyCompatible = true)._1 ne null) &&
isWithinBounds(NoPrefix, NoSymbol, okparams, okargs) isWithinBounds(NoPrefix, NoSymbol, okparams, okargs)
Expand Down
2 changes: 2 additions & 0 deletions test/files/run/t3761-overload-byname.check
Expand Up @@ -2,3 +2,5 @@ hello!
hello working world hello working world
goodnight! goodnight!
goodnight moon, nobody, noises everywhere goodnight moon, nobody, noises everywhere
0
1
5 changes: 5 additions & 0 deletions test/files/run/t3761-overload-byname.scala
Expand Up @@ -6,6 +6,9 @@ class OverTheTop {
// as reported // as reported
def info1(m: =>String) = m + "!" def info1(m: =>String) = m + "!"
def info1(m: =>String, args: Any*) = m +" "+ args.mkString(", ") def info1(m: =>String, args: Any*) = m +" "+ args.mkString(", ")

// @lrytz
def m[A](x: => Int) = 0; def m[A](x: => Int, xs: Int*) = 1
} }
object Test { object Test {
def main(args: Array[String]) { def main(args: Array[String]) {
Expand All @@ -14,5 +17,7 @@ object Test {
println(top.info0("hello","working","world")) println(top.info0("hello","working","world"))
println(top.info1("goodnight")) println(top.info1("goodnight"))
println(top.info1("goodnight", "moon", "nobody", "noises everywhere")) println(top.info1("goodnight", "moon", "nobody", "noises everywhere"))
println(top.m(17))
println(top.m(17,19))
} }
} }

0 comments on commit 8de2caa

Please sign in to comment.