summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.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/NamesDefaults.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/NamesDefaults.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index 50f658f68d..39cd610b1c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -521,8 +521,22 @@ trait NamesDefaults { self: Analyzer =>
WarnAfterNonSilentRecursiveInference(param, arg)(context)
res
} match {
- case SilentResultValue(t) => !t.isErroneous // #4041
- case _ => false
+ case SilentResultValue(t) =>
+ !t.isErroneous // #4041
+ case SilentTypeError(e: NormalTypeErrorFromCyclicReference) =>
+ // If we end up here, the CyclicReference was reported in a silent context. This can
+ // happen for local definitions, when the completer for a definition is created during
+ // type checking in silent mode. ContextErrors.TypeSigError catches that cyclic reference
+ // and transforms it into a NormalTypeErrorFromCyclicReference.
+ // The cycle needs to be reported, because the program cannot be typed: we don't know
+ // if we have an assignment or a named arg.
+ context.issue(e)
+ // 'err = true' is required because we're in a silent context
+ WarnAfterNonSilentRecursiveInference(param, arg)(context)
+ false
+ case _ =>
+ // We got a type error, so it cannot be an assignment (it doesn't type check as one).
+ false
}
catch {
// `silent` only catches and returns TypeErrors which are not