Commit 2c4ac2f
committed
Determistic output from the async macro
Eliminates the failures reported by the new `testDeterminism` task:
Before:
```
% sbt testDeterminism
[error] java.lang.AssertionError: /Users/jz/code/scala-async/target/scala-2.12/test-classes-baseline/scala/async/neg/LocalClasses0Spec$stateMachine$async$2.class is not equal to /Users/jz/code/scala-async/target/scala-2.12/test-classes/scala/async/neg/LocalClasses0Spec$stateMachine$async$2.class
[error] Use 'last' for the full log.
$ jardiff /Users/jz/code/scala-async/target/scala-2.12/test-classes-baseline /Users/jz/code/scala-async/target/scala-2.12/test-classes
diff --git a/scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.class.asm b/scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.class.asm
index f6f7d26..585e1b5 100644
--- a/scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.class.asm
+++ b/scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.class.asm
@@ -256,10 +256,10 @@
PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.state$async : I
ALOAD 0
ACONST_NULL
- PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.await$async$0 : Lscala/async/run/ifelse4/TestIfElse4Class$S;
+ PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.await$async$1 : Lscala/async/run/ifelse4/TestIfElse4Class$S;
ALOAD 0
ACONST_NULL
- PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.await$async$1 : Lscala/async/run/ifelse4/TestIfElse4Class$S;
+ PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.await$async$0 : Lscala/async/run/ifelse4/TestIfElse4Class$S;
ALOAD 0
GETSTATIC scala/runtime/BoxedUnit.UNIT : Lscala/runtime/BoxedUnit;
PUTFIELD scala/async/run/ifelse4/TestIfElse4Class$stateMachine$async$1.match$async$1 : Ljava/lang/Object;
diff --git a/scala/async/run/match0/MatchSpec$stateMachine$async$5.class.asm b/scala/async/run/match0/MatchSpec$stateMachine$async$5.class.asm
index caa05ea..fac9cd9 100644
--- a/scala/async/run/match0/MatchSpec$stateMachine$async$5.class.asm
+++ b/scala/async/run/match0/MatchSpec$stateMachine$async$5.class.asm
@@ -88,7 +88,7 @@
L3
ALOAD 0
ICONST_0
- PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
+ PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
LDC ""
INVOKEVIRTUAL java/lang/String.isEmpty ()Z
IFEQ L17
@@ -123,7 +123,7 @@
ALOAD 0
ALOAD 0
GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.await$async$0 : I
- PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
+ PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
GOTO L1
L7
ALOAD 0
@@ -135,7 +135,7 @@
ATHROW
L8
ALOAD 0
- GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
+ GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
ISTORE 5
ALOAD 0
BIPUSH 6
@@ -151,7 +151,7 @@
L10
ALOAD 0
ICONST_0
- PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
+ PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
ALOAD 0
GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.await$async$1 : I
ISTORE 6
@@ -216,7 +216,7 @@
GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.y$async$1 : I
ILOAD 10
IMUL
- PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
+ PUTFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
GOTO L1
L15
ALOAD 0
@@ -224,7 +224,7 @@
NEW scala/util/Success
DUP
ALOAD 0
- GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0 : I
+ GETFIELD scala/async/run/match0/MatchSpec$stateMachine$async$5.match$async$0$async$1 : I
INVOKESTATIC scala/runtime/BoxesRunTime.boxToInteger (I)Ljava/lang/Integer;
INVOKESPECIAL scala/util/Success.<init> (Ljava/lang/Object;)V
INVOKEVIRTUAL scala/util/Success.get ()Ljava/lang/Object;
diff --git a/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.class.asm b/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.class.asm
index 642ac1b..d637739 100644
--- a/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.class.asm
+++ b/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.class.asm
@@ -219,6 +219,9 @@
ICONST_5
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.state$async : I
ALOAD 0
+ ACONST_NULL
+ PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.await$async$0 : Lscala/None$;
+ ALOAD 0
NEW scala/async/run/toughtype/ParamWrapper
DUP
ACONST_NULL
@@ -234,9 +237,6 @@
CHECKCAST java/lang/String
L23
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.valueHolder$async$1 : Ljava/lang/String;
- ALOAD 0
- ACONST_NULL
- PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.await$async$0 : Lscala/None$;
ALOAD 0
GETSTATIC scala/None$.MODULE$ : Lscala/None$;
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$17.match$async$0 : Lscala/None$;
diff --git a/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.class.asm b/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.class.asm
index 5c15112..0b81dba 100644
--- a/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.class.asm
+++ b/scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.class.asm
@@ -216,9 +216,6 @@
ICONST_5
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.state$async : I
ALOAD 0
- ACONST_NULL
- PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.await$async$0 : Lscala/None$;
- ALOAD 0
NEW scala/async/run/toughtype/PrivateWrapper
DUP
ACONST_NULL
@@ -234,6 +231,9 @@
L23
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.valueHolder$async$1 : Ljava/lang/String;
ALOAD 0
+ ACONST_NULL
+ PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.await$async$0 : Lscala/None$;
+ ALOAD 0
GETSTATIC scala/None$.MODULE$ : Lscala/None$;
PUTFIELD scala/async/run/toughtype/ToughTypeSpec$stateMachine$async$18.match$async$0 : Lscala/None$;
GOTO L1
```
After:
```
$ for i in {1..10}; do sbt testDeterminism || break; done
...
<NO ERRORS>
```1 parent 6ecaf0f commit 2c4ac2f
File tree
3 files changed
+38
-26
lines changed- src/main/scala/scala/async/internal
3 files changed
+38
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
70 | | - | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
88 | | - | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
100 | | - | |
| 102 | + | |
101 | 103 | | |
102 | | - | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | | - | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
150 | | - | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
| 27 | + | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
265 | | - | |
266 | | - | |
| 267 | + | |
| 268 | + | |
267 | 269 | | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
273 | | - | |
| 275 | + | |
274 | 276 | | |
275 | 277 | | |
276 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
303 | 305 | | |
304 | 306 | | |
305 | 307 | | |
306 | | - | |
307 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
308 | 317 | | |
309 | 318 | | |
310 | 319 | | |
| |||
0 commit comments