diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-19 11:32:44 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-05-19 11:32:44 +0200 |
commit | c29e9754b94cc352337791c9e36131f5b8be385d (patch) | |
tree | de7a11d622af2bd7f1dd44ef8eaf494242afdad1 /test | |
parent | c9ac3d7267fe53dfbd3f57658049637ab218b3d5 (diff) | |
download | dotty-c29e9754b94cc352337791c9e36131f5b8be385d.tar.gz dotty-c29e9754b94cc352337791c9e36131f5b8be385d.tar.bz2 dotty-c29e9754b94cc352337791c9e36131f5b8be385d.zip |
Fix dotc bootstrap failure
During an attempted dotty bootstrap it was noted that Types.scala did not compile
anymore, because `checkUnique` threw a `TypeError` during erasure. The issue was an
overloaded member `name` in TermrefWithSig. In NamedType:
def name: Name
In TermRef:
def name: TermName
Before erasure, there's one member `name`, after erasure there are two (because after
erasure result type counts). The error arose when trying to recompute a member
of a `TermRefWithSig` where the name is `name` and the expected signature is `(Nil, ?)`.
Since there are two members that match the name and the signature, `checkUnique`
triggered a `TypeError`. Before adding `checkUnique`, the previous `atSignature`
call would just have returned an arbitrary choice among the two alternative definitions
of `name`.
The fix is not to use `checkUnique` but to fall back to `d.current` in the case where
several alternatives appear.
Interestingly, the failure only triggers when -Ycheck options are *disabled*. I added a new
test that compiles Types.scala without checks, so we catch this and possibly similar bugs
in the future.
Diffstat (limited to 'test')
-rw-r--r-- | test/dotc/tests.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 97c872bb6..de35d281b 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -157,6 +157,7 @@ class tests extends CompilerTest { @Test def dotc_ast = compileDir(dotcDir, "ast") @Test def dotc_config = compileDir(dotcDir, "config") @Test def dotc_core = compileDir(dotcDir, "core")("-Yno-double-bindings" :: allowDeepSubtypes)// twice omitted to make tests run faster + @Test def dotc_core_Types = compileFile(dotcDir, "core/Types")(noCheckOptions) // This directory doesn't exist anymore // @Test def dotc_core_pickling = compileDir(coreDir, "pickling")(allowDeepSubtypes)// twice omitted to make tests run faster |