From 28d34696dced349e49e3517db0390bc2152ee689 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 19 Nov 2019 20:39:37 +0100 Subject: [PATCH] Fix #7575: Drop support of -language:_ --- compiler/src/dotty/tools/dotc/core/TypeOps.scala | 2 +- compiler/test/dotty/tools/dotc/CompilationTests.scala | 6 ++++-- tests/neg/i7575.scala | 2 ++ tests/neg/i7575b.scala | 2 ++ tests/pos-special/i7575.scala | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/neg/i7575.scala create mode 100644 tests/neg/i7575b.scala create mode 100644 tests/pos-special/i7575.scala diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index eea252d4522e..aef79d55120a 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -491,7 +491,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object. if (!sym.exists) "" else toPrefix(sym.owner) + sym.name + "." val featureName = toPrefix(owner) + feature - ctx.base.settings.language.value exists (s => s == featureName || s == "_") + ctx.base.settings.language.value exists (s => s == featureName) } hasOption || hasImport } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index ae72c806da44..fcc591cf9057 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -60,7 +60,8 @@ class CompilationTests extends ParallelTesting { compileFile("tests/pos-special/indent-colons.scala", defaultOptions.and("-Yindent-colons")), compileFile("tests/pos-special/i7296.scala", defaultOptions.and("-strict", "-deprecation", "-Xfatal-warnings")), compileFile("tests/pos-special/nullable.scala", defaultOptions.and("-Yexplicit-nulls")), - compileDir("tests/pos-special/adhoc-extension", defaultOptions.and("-strict", "-feature", "-Xfatal-warnings")) + compileDir("tests/pos-special/adhoc-extension", defaultOptions.and("-strict", "-feature", "-Xfatal-warnings")), + compileFile("tests/pos-special/i7575.scala", defaultOptions.and("-language:dynamics")), ).checkCompile() } @@ -145,7 +146,8 @@ class CompilationTests extends ParallelTesting { compileFile("tests/neg-custom-args/wildcards.scala", defaultOptions.and("-strict", "-deprecation", "-Xfatal-warnings")), compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-noindent", "-Xfatal-warnings")), compileFile("tests/neg-custom-args/extmethods-tparams.scala", defaultOptions.and("-deprecation", "-Xfatal-warnings")), - compileDir("tests/neg-custom-args/adhoc-extension", defaultOptions.and("-strict", "-feature", "-Xfatal-warnings")) + compileDir("tests/neg-custom-args/adhoc-extension", defaultOptions.and("-strict", "-feature", "-Xfatal-warnings")), + compileFile("tests/neg/i7575.scala", defaultOptions.and("-language:_")), ).checkExpectedErrors() } diff --git a/tests/neg/i7575.scala b/tests/neg/i7575.scala new file mode 100644 index 000000000000..ec9f2dd9793c --- /dev/null +++ b/tests/neg/i7575.scala @@ -0,0 +1,2 @@ +class Foo() extends Dynamic // error: extension of type scala.Dynamic needs to be enabled +// tested as is and with -language:_ diff --git a/tests/neg/i7575b.scala b/tests/neg/i7575b.scala new file mode 100644 index 000000000000..af71c535df5f --- /dev/null +++ b/tests/neg/i7575b.scala @@ -0,0 +1,2 @@ +import scala.language._ +class Foo() extends Dynamic // error: extension of type scala.Dynamic needs to be enabled diff --git a/tests/pos-special/i7575.scala b/tests/pos-special/i7575.scala new file mode 100644 index 000000000000..a2193cf8b4ea --- /dev/null +++ b/tests/pos-special/i7575.scala @@ -0,0 +1 @@ +class Foo() extends Dynamic // tested with -language:dynamics