Skip to content

Commit

Permalink
Merge pull request scala#3272 from dotty-staging/fix-deep-subtypes
Browse files Browse the repository at this point in the history
Avoid most deep subtypes in test
  • Loading branch information
smarter authored Oct 6, 2017
2 parents a4e2320 + eb2fdf2 commit 7c8f557
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
16 changes: 14 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,20 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
isApplicable(alt2, formals1, WildcardType) ||
tp1.paramInfos.isEmpty && tp2.isInstanceOf[LambdaType]
case tp1: PolyType => // (2)
val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds)
isAsSpecific(alt1, tp1.instantiate(tparams.map(_.typeRef)), alt2, tp2)
val nestedCtx = ctx.fresh.setExploreTyperState()

{
implicit val ctx = nestedCtx

// Fully define the type so that the types of the tparams created
// below never contain TypeRefs whose underling types contain
// uninstantiated TypeVars, this could lead to cycles in `isSubType`
// as a TypeVar might get constrained by a TypeRef it's part of.
val tp1a = fullyDefinedType(tp1, "alternative", alt1.symbol.pos).asInstanceOf[PolyType]

val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1a.instantiateBounds)
isAsSpecific(alt1, tp1a.instantiate(tparams.map(_.typeRef)), alt2, tp2)
}
case _ => // (3)
tp2 match {
case tp2: MethodType => true // (3a)
Expand Down
1 change: 0 additions & 1 deletion compiler/test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ class tests extends CompilerTest {

@Test def rewrites = compileFile(posScala2Dir, "rewrites", "-rewrite" :: scala2mode)

@Test def pos_t8146a = compileFile(posSpecialDir, "t8146a")(allowDeepSubtypes)
@Test def pos_jon = compileFile(posSpecialDir, "jon")(allowDeepSubtypes)

@Test def pos_t5545 = {
Expand Down
13 changes: 6 additions & 7 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class CompilationTests extends ParallelTesting {
compileList("compileStdLib", StdLibSources.whitelisted, scala2Mode.and("-migration", "-Yno-inline")) +
compileDir("../compiler/src/dotty/tools/dotc/ast", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/config", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/core", allowDeepSubtypes) +
compileDir("../compiler/src/dotty/tools/dotc/transform", allowDeepSubtypes) +
compileDir("../compiler/src/dotty/tools/dotc/core", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/transform", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/parsing", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/printing", defaultOptions) +
compileDir("../compiler/src/dotty/tools/dotc/reporting", defaultOptions) +
Expand All @@ -51,7 +51,6 @@ class CompilationTests extends ParallelTesting {
compileDir("../compiler/src/dotty/tools/dotc/core", TestFlags(classPath, noCheckOptions)) +
compileFile("../tests/pos/nullarify.scala", defaultOptions.and("-Ycheck:nullarify")) +
compileFile("../tests/pos-scala2/rewrites.scala", scala2Mode.and("-rewrite")).copyToTarget() +
compileFile("../tests/pos-special/t8146a.scala", allowDeepSubtypes) +
compileFile("../tests/pos-special/utf8encoded.scala", explicitUTF8) +
compileFile("../tests/pos-special/utf16encoded.scala", explicitUTF16) +
compileList(
Expand Down Expand Up @@ -198,8 +197,8 @@ class CompilationTests extends ParallelTesting {
// lower level of concurrency as to not kill their running VMs

@Test def testPickling: Unit = {
compileDir("../compiler/src/dotty/tools", picklingOptionsAllowDeepSubTypes) +
compileDir("../compiler/src/dotty/tools/dotc", picklingOptionsAllowDeepSubTypes) +
compileDir("../compiler/src/dotty/tools", picklingOptions) +
compileDir("../compiler/src/dotty/tools/dotc", picklingOptions) +
compileFilesInDir("../tests/new", picklingOptions) +
compileFilesInDir("../tests/pickling", picklingOptions) +
compileDir("../library/src/dotty/runtime", picklingOptions) +
Expand All @@ -211,7 +210,7 @@ class CompilationTests extends ParallelTesting {
compileDir("../compiler/src/dotty/tools/dotc/printing", picklingOptions) +
compileDir("../compiler/src/dotty/tools/repl", picklingOptions) +
compileDir("../compiler/src/dotty/tools/dotc/rewrite", picklingOptions) +
compileDir("../compiler/src/dotty/tools/dotc/transform", picklingOptionsAllowDeepSubTypes) +
compileDir("../compiler/src/dotty/tools/dotc/transform", picklingOptions) +
compileDir("../compiler/src/dotty/tools/dotc/typer", picklingOptions) +
compileDir("../compiler/src/dotty/tools/dotc/util", picklingOptions) +
compileDir("../compiler/src/dotty/tools/io", picklingOptions) +
Expand All @@ -237,7 +236,7 @@ class CompilationTests extends ParallelTesting {

def lib =
compileDir("../library/src",
allowDeepSubtypes.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))
defaultOptions.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))

val compilerDir = Paths.get("../compiler/src")
val compilerSources = sources(Files.walk(compilerDir))
Expand Down
1 change: 0 additions & 1 deletion compiler/test/dotty/tools/vulpix/TestConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ object TestConfiguration {
"-Ytest-pickler",
"-Yprintpos"
)
val picklingOptionsAllowDeepSubTypes = picklingOptions without "-Yno-deep-subtypes"
val scala2Mode = defaultOptions and "-language:Scala2"
val explicitUTF8 = defaultOptions and ("-encoding", "UTF8")
val explicitUTF16 = defaultOptions and ("-encoding", "UTF16")
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7c8f557

Please sign in to comment.