Skip to content

Fix #3533: Fix parsing of raw types appearing in generic position #3755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ClassfileParser(

for (i <- 0 until in.nextChar) parseMember(method = false)
for (i <- 0 until in.nextChar) parseMember(method = true)
classInfo = cook.apply(parseAttributes(classRoot.symbol, classInfo))
classInfo = parseAttributes(classRoot.symbol, classInfo)
if (isAnnotation) addAnnotationConstructor(classInfo)

val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, classRoot, moduleRoot)
Expand Down Expand Up @@ -261,7 +261,7 @@ class ClassfileParser(
addConstructorTypeParams(denot)
}

denot.info = cook.apply(pool.getType(in.nextChar))
denot.info = pool.getType(in.nextChar)
if (isEnum) denot.info = ConstantType(Constant(sym))
if (isConstructor) normalizeConstructorParams()
setPrivateWithin(denot, jflags)
Expand Down Expand Up @@ -625,7 +625,8 @@ class ClassfileParser(
for (i <- 0 until in.nextChar) {
parseAttribute()
}
newType

cook.apply(newType)
}

/** Add synthetic constructor(s) and potentially also default getters which
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class CompilationTests extends ParallelTesting {
),
scala2Mode
) +
compileFilesInDir("../tests/pos-special/i3273", defaultOptions) +
compileFilesInDir("../tests/pos-special/spec-t5545", defaultOptions) +
compileFilesInDir("../tests/pos-special/strawman-collections", defaultOptions) +
compileFile("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala", defaultOptions) +
Expand Down Expand Up @@ -110,6 +109,7 @@ class CompilationTests extends ParallelTesting {
implicit val testGroup: TestGroup = TestGroup("posTwice")
compileFile("../tests/pos/Labels.scala", defaultOptions) +
compileFilesInDir("../tests/pos-java-interop", defaultOptions) +
compileFilesInDir("../tests/pos-java-interop-separate", defaultOptions) +
compileFile("../tests/pos/t2168.scala", defaultOptions) +
compileFile("../tests/pos/erasure.scala", defaultOptions) +
compileFile("../tests/pos/Coder.scala", defaultOptions) +
Expand Down
5 changes: 4 additions & 1 deletion compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>

// Compile with a try to catch any StackTrace generated by the compiler:
try {
driver.process(allArgs ++ files.map(_.getAbsolutePath), reporter = reporter)
// If a test contains a Java file that cannot be parsed by Dotty's Java source parser, its
// name must contain the string "JAVA_ONLY".
val dottyFiles = files.filterNot(_.getName.contains("JAVA_ONLY")).map(_.getAbsolutePath)
driver.process(allArgs ++ dottyFiles, reporter = reporter)

val javaFiles = files.filter(_.getName.endsWith(".java")).map(_.getAbsolutePath)
val javaErrors = compileWithJavac(javaFiles)
Expand Down
3 changes: 3 additions & 0 deletions tests/pos-java-interop-separate/i3533/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Test {
TryMe_JAVA_ONLY_1.ifYouCan(list => list.size())
}
6 changes: 6 additions & 0 deletions tests/pos-java-interop-separate/i3533/TryMe_JAVA_ONLY_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import java.util.function.Function;

public class TryMe_JAVA_ONLY_1 {
public static void ifYouCan(Function<java.util.List, Integer> f) {
}
}