-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10676 from SethTisue/merge-2.12-to-2.13-20240126
Merge 2.12. to 2.13 [ci: last-only]
- Loading branch information
Showing
7 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// javaVersion: 21+ | ||
|
||
public class A_1 { | ||
public int f(Object s) { | ||
switch(s) { | ||
case Res.R -> { | ||
return 1; | ||
} | ||
default -> { | ||
return 3; | ||
} | ||
} | ||
} | ||
static enum Res { | ||
R | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// javaVersion: 21+ | ||
|
||
class B { | ||
def bar = (new A_1).f(null) | ||
} |
31 changes: 31 additions & 0 deletions
31
test/junit/scala/tools/nsc/backend/jvm/ClassfileParserTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package scala.tools.nsc.backend.jvm | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
import java.lang.reflect.Member | ||
|
||
class ClassfileParserTest { | ||
@Test | ||
def noConstantPoolLag(): Unit = { | ||
def constNames(ms: List[Member]) = ms.collect { | ||
case f if f.getName.startsWith("CONSTANT_") => f.getName | ||
}.sorted | ||
|
||
val toScalac = Map( | ||
"CONSTANT_INTERFACE_METHODREF" -> "CONSTANT_INTFMETHODREF", | ||
"CONSTANT_INVOKE_DYNAMIC" -> "CONSTANT_INVOKEDYNAMIC", | ||
"CONSTANT_METHOD_HANDLE" -> "CONSTANT_METHODHANDLE", | ||
"CONSTANT_METHOD_TYPE" -> "CONSTANT_METHODTYPE", | ||
"CONSTANT_NAME_AND_TYPE" -> "CONSTANT_NAMEANDTYPE", | ||
).withDefault(x => x) | ||
|
||
val asmConsts = constNames(Class.forName("scala.tools.asm.Symbol").getDeclaredFields.toList) | ||
.map(_.stripSuffix("_TAG")) | ||
.map(toScalac) | ||
.::("CONSTANT_UNICODE") | ||
.sorted | ||
val scalacConsts = constNames(scala.reflect.internal.ClassfileConstants.getClass.getDeclaredMethods.toList) | ||
assertEquals(scalacConsts, asmConsts) | ||
} | ||
} |