summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-02-13 10:16:13 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-02-13 10:16:13 -0800
commit4554a10bcafce6fb14eb8b123bf76887bb6a8114 (patch)
tree0d82c10b71938c4559cc19ab438fe80bf16f6218 /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
parent73478ea4d64c62899440bfa0a748e3d57d1ab85d (diff)
parenta4a892fb0196f2f66d86f9cfa508deabe7d2aaae (diff)
downloadscala-4554a10bcafce6fb14eb8b123bf76887bb6a8114.tar.gz
scala-4554a10bcafce6fb14eb8b123bf76887bb6a8114.tar.bz2
scala-4554a10bcafce6fb14eb8b123bf76887bb6a8114.zip
Merge pull request #4195 from lrytz/t8841
SI-8841 report named arg / assignment ambiguity also in silent mode.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 5c36bd9d28..c80aaea160 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -45,6 +45,14 @@ trait ContextErrors {
case class NormalTypeError(underlyingTree: Tree, errMsg: String)
extends TreeTypeError
+ /**
+ * Marks a TypeError that was constructed from a CyclicReference (under silent).
+ * This is used for named arguments, where we need to know if an assignment expression
+ * failed with a cyclic reference or some other type error.
+ */
+ class NormalTypeErrorFromCyclicReference(underlyingTree: Tree, errMsg: String)
+ extends NormalTypeError(underlyingTree, errMsg)
+
case class AccessTypeError(underlyingTree: Tree, errMsg: String)
extends TreeTypeError
@@ -1087,8 +1095,9 @@ trait ContextErrors {
// hence we (together with reportTypeError in TypeDiagnostics) make sure that this CyclicReference
// evades all the handlers on its way and successfully reaches `isCyclicOrErroneous` in Implicits
throw ex
- case CyclicReference(sym, info: TypeCompleter) =>
- issueNormalTypeError(tree, typer.cyclicReferenceMessage(sym, info.tree) getOrElse ex.getMessage())
+ case c @ CyclicReference(sym, info: TypeCompleter) =>
+ val error = new NormalTypeErrorFromCyclicReference(tree, typer.cyclicReferenceMessage(sym, info.tree) getOrElse ex.getMessage)
+ issueTypeError(error)
case _ =>
contextNamerErrorGen.issue(TypeErrorWithUnderlyingTree(tree, ex))
}
@@ -1275,8 +1284,8 @@ trait ContextErrors {
}
def WarnAfterNonSilentRecursiveInference(param: Symbol, arg: Tree)(implicit context: Context) = {
- val note = "type-checking the invocation of "+ param.owner +" checks if the named argument expression '"+ param.name + " = ...' is a valid assignment\n"+
- "in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for "+ param.name +"."
+ val note = "failed to determine if '"+ param.name + " = ...' is a named argument or an assignment expression.\n"+
+ "an explicit type is required for the definition mentioned in the error message above."
context.warning(arg.pos, note)
}