File tree Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Original file line number Diff line number Diff line change
1
+ package test
2
+
3
+ import org .junit .Assert ._
4
+ import org .junit .Test
5
+
6
+ class InlineBytecodeTests extends DottyBytecodeTest {
7
+ import ASMConverters ._
8
+ @ Test def inlineUnit = {
9
+ val source = """
10
+ |class Foo {
11
+ | inline def foo: Int = 1
12
+ |
13
+ | def meth1: Unit = foo
14
+ | def meth2: Unit = 1
15
+ |}
16
+ """ .stripMargin
17
+
18
+ checkBCode(source) { dir =>
19
+ val clsIn = dir.lookupName(" Foo.class" , directory = false ).input
20
+ val clsNode = loadClassNode(clsIn)
21
+ val meth1 = getMethod(clsNode, " meth1" )
22
+ val meth2 = getMethod(clsNode, " meth2" )
23
+
24
+ val instructions1 = instructionsFromMethod(meth1)
25
+ val instructions2 = instructionsFromMethod(meth2)
26
+
27
+ assert(instructions1 == instructions2,
28
+ " `foo` was not properly inlined in `meth1`\n " +
29
+ diffInstructions(instructions1, instructions2))
30
+ }
31
+ }
32
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments