aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-09-04 19:27:09 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-06 17:45:38 +0200
commitaf27562040631d0bea38ec3ff8912fda9939f34e (patch)
treec1984c9147ee9271d6f535af006df65e0073e4b2
parent49b19933dc23220e582016fc0bfd0b35961d61a1 (diff)
downloaddotty-af27562040631d0bea38ec3ff8912fda9939f34e.tar.gz
dotty-af27562040631d0bea38ec3ff8912fda9939f34e.tar.bz2
dotty-af27562040631d0bea38ec3ff8912fda9939f34e.zip
Typecheck usecases in fresh local scope
-rw-r--r--dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala2
-rw-r--r--dottydoc/test/BaseTest.scala2
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala1
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala2
-rw-r--r--src/dotty/tools/dotc/parsing/Scanners.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
6 files changed, 5 insertions, 7 deletions
diff --git a/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala b/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
index 380d8fda2..77ceb179d 100644
--- a/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
+++ b/dottydoc/src/dotty/tools/dottydoc/DottyDoc.scala
@@ -55,7 +55,7 @@ abstract class DocDriver extends Driver {
val summary = CompilerCommand.distill(args)(ctx)
ctx.setSettings(summary.sstate)
- ctx.setSetting(ctx.settings.Ydocrun, true)
+ ctx.setSetting(ctx.settings.YkeepComments, true)
val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)(ctx)
(fileNames, ctx)
diff --git a/dottydoc/test/BaseTest.scala b/dottydoc/test/BaseTest.scala
index fa8e5d1e6..1aa426886 100644
--- a/dottydoc/test/BaseTest.scala
+++ b/dottydoc/test/BaseTest.scala
@@ -18,7 +18,7 @@ trait DottyTest {
val ctx = base.initialCtx.fresh
ctx.setSetting(ctx.settings.language, List("Scala2"))
ctx.setSetting(ctx.settings.YnoInline, true)
- ctx.setSetting(ctx.settings.Ydocrun, true)
+ ctx.setSetting(ctx.settings.YkeepComments, true)
base.initialize()(ctx)
ctx
}
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index 9304daf98..ff17a9939 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -171,7 +171,6 @@ class ScalaSettings extends Settings.SettingGroup {
val Ybuildmanagerdebug = BooleanSetting("-Ybuild-manager-debug", "Generate debug information for the Refined Build Manager compiler.")
val Ycompletion = BooleanSetting("-Ycompletion-debug", "Trace all tab completion activity.")
val Ydocdebug = BooleanSetting("-Ydoc-debug", "Trace all scaladoc activity.")
- val Ydocrun = BooleanSetting("-Ydoc-run", "Current run should be treated as a docrun, enables `@usecase` annotations in comments")
val Yidedebug = BooleanSetting("-Yide-debug", "Generate, validate and output trees using the interactive compiler.")
val Yinferdebug = BooleanSetting("-Yinfer-debug", "Trace type inference and implicit search.")
val Yissuedebug = BooleanSetting("-Yissue-debug", "Print stack traces when a context issues an error.")
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 34612e83d..018b050ff 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1541,7 +1541,7 @@ object SymDenotations {
/** Enter a symbol in given `scope` without potentially replacing the old copy. */
def enterNoReplace(sym: Symbol, scope: MutableScope)(implicit ctx: Context): Unit = {
- lazy val isUsecase = ctx.settings.Ydocrun.value && sym.name.show.takeRight(4) == "$doc"
+ def isUsecase = sym.name.show.takeRight(4) == "$doc"
require(
(sym.denot.flagsUNSAFE is Private) ||
!(this is Frozen) ||
diff --git a/src/dotty/tools/dotc/parsing/Scanners.scala b/src/dotty/tools/dotc/parsing/Scanners.scala
index 8aee757ce..60003d098 100644
--- a/src/dotty/tools/dotc/parsing/Scanners.scala
+++ b/src/dotty/tools/dotc/parsing/Scanners.scala
@@ -172,7 +172,7 @@ object Scanners {
}
class Scanner(source: SourceFile, override val startFrom: Offset = 0)(implicit ctx: Context) extends ScannerCommon(source)(ctx) {
- val keepComments = ctx.settings.YkeepComments.value || ctx.settings.Ydocrun.value
+ val keepComments = ctx.settings.YkeepComments.value
/** All doc comments as encountered, each list contains doc comments from
* the same block level. Starting with the deepest level and going upward
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index b24fc6237..3291cb9d0 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1247,8 +1247,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val dummy = localDummy(cls, impl)
val body1 = typedStats(impl.body, dummy)(inClassContext(self1.symbol))
- if (ctx.settings.Ydocrun.value)
- typedUsecases(body1.map(_.symbol), self1.symbol)
+ typedUsecases(body1.map(_.symbol), self1.symbol)(localContext(cdef, cls).setNewScope)
checkNoDoubleDefs(cls)
val impl1 = cpy.Template(impl)(constr1, parents1, self1, body1)