Skip to content
Permalink
Browse files

Fixes SI-5801, error messages regression. Review by @adriaanm

  • Loading branch information
hubertp committed May 16, 2012
1 parent 97046e6 commit 7490250efe8e7b59be9d168048f40344b3066b61
Showing with 41 additions and 1 deletion.
  1. +3 −1 src/compiler/scala/tools/nsc/typechecker/Typers.scala
  2. +22 −0 test/files/neg/t5801.check
  3. +16 −0 test/files/neg/t5801.scala
@@ -109,6 +109,8 @@ trait Typers extends Modes with Adaptations with Taggings {
case MethodType(params, _) =>
val argResultsBuff = new ListBuffer[SearchResult]()
val argBuff = new ListBuffer[Tree]()
// paramFailed cannot be initialized with params.exists(_.tpe.isError) because that would
// hide some valid errors for params preceding the erroneous one.
var paramFailed = false

def mkPositionalArg(argTree: Tree, paramName: Name) = argTree
@@ -124,7 +126,7 @@ trait Typers extends Modes with Adaptations with Taggings {
for(ar <- argResultsBuff)
paramTp = paramTp.subst(ar.subst.from, ar.subst.to)

val res = if (paramFailed) SearchFailure else inferImplicit(fun, paramTp, context.reportErrors, false, context)
val res = if (paramFailed || (paramTp.isError && {paramFailed = true; true})) SearchFailure else inferImplicit(fun, paramTp, context.reportErrors, false, context)
argResultsBuff += res

if (res != SearchFailure) {
@@ -0,0 +1,22 @@
t5801.scala:1: error: object sth is not a member of package scala
import scala.sth
^
t5801.scala:4: error: not found: value sth
def foo(a: Int)(implicit b: sth.Sth): Unit = {}
^
t5801.scala:7: error: not found: value sth
def bar(x: Int)(implicit y: Int): sth.Sth = null
^
t5801.scala:8: error: could not find implicit value for parameter y: Int
bar(1)
^
t5801.scala:10: error: not found: value sth
def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
^
t5801.scala:13: error: not found: value sth
def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
^
t5801.scala:14: error: could not find implicit value for parameter b: Int
meh2(1)
^
7 errors found
@@ -0,0 +1,16 @@
import scala.sth

object Test extends App {
def foo(a: Int)(implicit b: sth.Sth): Unit = {}
foo(1)

def bar(x: Int)(implicit y: Int): sth.Sth = null
bar(1)

def meh(x: Int)(implicit a: sth.Sth, b: Int): Unit = {}
meh(1)

def meh2(x: Int)(implicit b: Int, a: sth.Sth): Unit = {}
meh2(1)
}

3 comments on commit 7490250

@adriaanm

This comment has been minimized.

Copy link
Member

@adriaanm adriaanm replied May 19, 2012

@hubertp

This comment has been minimized.

Copy link
Member Author

@hubertp hubertp replied May 19, 2012

It was based on an old master. Everything is fine.

@adriaanm

This comment has been minimized.

Copy link
Member

@adriaanm adriaanm replied May 19, 2012

ok, sorry for the confusion

Please sign in to comment.
You can’t perform that action at this time.