diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-19 16:46:25 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-19 16:46:25 -0700 |
commit | 5147bb278c326e60956bac93cba95d4e07d95e84 (patch) | |
tree | 4d002fd0162181f0e7027954f0caa1a6500c039b /src | |
parent | 2e83e45ebf05de7312350232ded7d73956999f7f (diff) | |
parent | 351d5ec22688a48227b76f417a0dd520934d98d7 (diff) | |
download | scala-5147bb278c326e60956bac93cba95d4e07d95e84.tar.gz scala-5147bb278c326e60956bac93cba95d4e07d95e84.tar.bz2 scala-5147bb278c326e60956bac93cba95d4e07d95e84.zip |
Merge pull request #2408 from paulp/pr/fully-qualified-name
Absolute path in error message.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 8cfb975a54..c21dfe6ec7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -777,16 +777,19 @@ trait Typers extends Modes with Adaptations with Tags { if (!OK) { val Some(AnnotationInfo(_, List(Literal(Constant(featureDesc: String)), Literal(Constant(required: Boolean))), _)) = featureTrait getAnnotation LanguageFeatureAnnot - val req = if (required) "needs to" else "should" - var raw = featureDesc + " " + req + " be enabled\n" + - "by making the implicit value language." + featureName + " visible." - if (!(currentRun.reportedFeature contains featureTrait)) - raw += "\nThis can be achieved by adding the import clause 'import scala.language." + featureName + "'\n" + - "or by setting the compiler option -language:" + featureName + ".\n" + - "See the Scala docs for value scala.language." + featureName + " for a discussion\n" + - "why the feature " + req + " be explicitly enabled." + val req = if (required) "needs to" else "should" + val fqname = "scala.language." + featureName + val explain = ( + if (currentRun.reportedFeature contains featureTrait) "" else + s"""| + |This can be achieved by adding the import clause 'import $fqname' + |or by setting the compiler option -language:$featureName. + |See the Scala docs for value $fqname for a discussion + |why the feature $req be explicitly enabled.""".stripMargin + ) currentRun.reportedFeature += featureTrait - val msg = raw replace ("#", construct) + + val msg = s"$featureDesc $req be enabled\nby making the implicit value $fqname visible.$explain" replace ("#", construct) if (required) unit.error(pos, msg) else currentRun.featureWarnings.warn(pos, msg) } |