diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-19 03:49:51 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-19 03:49:51 -0700 |
commit | 2d2fe0cfcdbf7e450222027e34be733b714d3e7c (patch) | |
tree | 4a13b6e3a27d7122c16e06c7d323d18b4e51af4c /src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala | |
parent | 423db24e1f4765d19351ed5b10b571252bcb717d (diff) | |
parent | 4669ac180e58daf97ac7f73af4622434b439631d (diff) | |
download | scala-2d2fe0cfcdbf7e450222027e34be733b714d3e7c.tar.gz scala-2d2fe0cfcdbf7e450222027e34be733b714d3e7c.tar.bz2 scala-2d2fe0cfcdbf7e450222027e34be733b714d3e7c.zip |
Merge pull request #578 from lrytz/wip/t5044-squashed
fix SI-5044: better error message on cyclic error and named/default args
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index 9e6b9617a5..88e464a1f4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -478,7 +478,14 @@ trait NamesDefaults { self: Analyzer => // instead of arg, but can't do that because eventually setType(ErrorType) // is called, and EmptyTree can only be typed NoType. Thus we need to // disable conforms as a view... - try typer.silent(_.typed(arg, subst(paramtpe))) match { + val errsBefore = reporter.ERROR.count + try typer.silent { tpr => + val res = tpr.typed(arg, subst(paramtpe)) + // better warning for SI-5044: if `silent` was not actually silent give a hint to the user + if (errsBefore < reporter.ERROR.count) + WarnAfterNonSilentRecursiveInference(param, arg)(context) + res + } match { case SilentResultValue(t) => !t.isErroneous // #4041 case _ => false } @@ -487,7 +494,7 @@ trait NamesDefaults { self: Analyzer => // CyclicReferences. Fix for #3685 case cr @ CyclicReference(sym, _) => (sym.name == param.name) && sym.accessedOrSelf.isVariable && { - NameClashError(sym, arg)(typer.context) + NameClashError(sym, arg)(context) true } } |