summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-07 13:09:47 -0800
committerPaul Phillips <paulp@improving.org>2012-03-07 13:09:47 -0800
commitf2845f2c8fd010a1333ef7e449f18756f5080922 (patch)
tree6741eb431d32b7f5acaeeed6420e3d8da1cf50de /src
parent02fb34822b599043b5707c78addc63dcd1c947cf (diff)
parentb98d748c9ad1f9259f536c80ef513630ce2974a1 (diff)
downloadscala-f2845f2c8fd010a1333ef7e449f18756f5080922.tar.gz
scala-f2845f2c8fd010a1333ef7e449f18756f5080922.tar.bz2
scala-f2845f2c8fd010a1333ef7e449f18756f5080922.zip
Merge remote-tracking branch 'origin/develop'
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala8
4 files changed, 10 insertions, 9 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 64edbdb8bd..b7b7ca5840 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -4579,7 +4579,7 @@ trait Types extends api.Types { self: SymbolTable =>
var rebind0 = pre.findMember(sym.name, BRIDGE, 0, true)
if (rebind0 == NoSymbol) {
if (sym.isAliasType) throw missingAliasException
- if (settings.debug.value) println(pre+"."+sym+" does no longer exist, phase = "+phase)
+ debugwarn(pre+"."+sym+" does no longer exist, phase = "+phase)
throw new MissingTypeControl // For build manager and presentation compiler purposes
//assert(false, pre+"."+sym+" does no longer exist, phase = "+phase)
}
@@ -4635,7 +4635,7 @@ trait Types extends api.Types { self: SymbolTable =>
if ((pre1 eq pre) && (sym1 eq sym) && (args1 eq args)/* && sym.isExternal*/) {
tp
} else if (sym1 == NoSymbol) {
- if (settings.debug.value) println("adapt fail: "+pre+" "+pre1+" "+sym)
+ debugwarn("adapt fail: "+pre+" "+pre1+" "+sym)
tp
} else {
copyTypeRef(tp, pre1, sym1, args1)
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index afe0b42167..d7b4171c65 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -726,7 +726,6 @@ trait ContextErrors {
// we have to set the type of tree to ErrorType only in the very last
// fallback action that is done in the inference (tracking it manually is error prone).
// This avoids entering infinite loop in doTypeApply.
- // TODO: maybe we should do the same thing with inferExprAlternative.
if (implicitly[Context].reportErrors) setError(tree)
}
@@ -736,6 +735,8 @@ trait ContextErrors {
"argument types " + argtpes.mkString("(", ",", ")") +
(if (pt == WildcardType) "" else " and expected result type " + pt)
val (pos, msg) = ambiguousErrorMsgPos(tree.pos, pre, best, firstCompeting, msg0)
+ // discover last attempt in a similar way as for NoBestMethodAlternativeError
+ if (implicitly[Context].ambiguousErrors) setError(tree)
issueAmbiguousTypeError(pre, best, firstCompeting, AmbiguousTypeError(tree, pos, msg))
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 90e07023bb..2c564c097f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -312,13 +312,14 @@ trait Contexts { self: Analyzer =>
unit.error(pos, if (checking) "\n**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
def issue(err: AbsTypeError) {
- if (settings.debug.value) println("issue error: " + err.errMsg)
+ debugwarn("issue error: " + err.errMsg)
if (reportErrors) unitError(err.errPos, addDiagString(err.errMsg))
else if (bufferErrors) { buffer += err }
else throw new TypeError(err.errPos, err.errMsg)
}
def issueAmbiguousError(pre: Type, sym1: Symbol, sym2: Symbol, err: AbsTypeError) {
+ debugwarn("issue ambiguous error: " + err.errMsg)
if (ambiguousErrors) {
if (!pre.isErroneous && !sym1.isErroneous && !sym2.isErroneous)
unitError(err.errPos, err.errMsg)
@@ -327,6 +328,7 @@ trait Contexts { self: Analyzer =>
}
def issueAmbiguousError(err: AbsTypeError) {
+ debugwarn("issue ambiguous error: " + err.errMsg)
if (ambiguousErrors)
unitError(err.errPos, addDiagString(err.errMsg))
else if (bufferErrors) { buffer += err }
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 896d8c711d..cea5858915 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1493,14 +1493,12 @@ trait Infer {
if (improves(alt, best)) alt else best)
val competing = applicable.dropWhile(alt => best == alt || improves(best, alt))
if (best == NoSymbol) {
- if (pt == WildcardType)
- NoBestMethodAlternativeError(tree, argtpes, pt)
- else
- inferMethodAlternative(tree, undetparams, argtpes, WildcardType)
+ if (pt == WildcardType) NoBestMethodAlternativeError(tree, argtpes, pt)
+ else inferMethodAlternative(tree, undetparams, argtpes, WildcardType)
} else if (!competing.isEmpty) {
if (!(argtpes exists (_.isErroneous)) && !pt.isErroneous)
AmbiguousMethodAlternativeError(tree, pre, best, competing.head, argtpes, pt)
- setError(tree)
+ else setError(tree)
()
} else {
// checkNotShadowed(tree.pos, pre, best, applicable)