Commit a697514
committed
Fix init error in test
Note: due to const-fold, the code does not misbehave at runtime.
However, it's still good to report errors here, as in this case
const-fold changes the semantics of programs, which is too subtle for end users.
The field `elemSeparator` and `caseSeparator` are used before they are initialized.
-- Error: tests/run/typeclass-derivation2a.scala:31:22 -------------------------
31 | private final val elemSeparator = '\000'
| ^
|Access non-initialized field value elemSeparator. Calling trace:
| -> initLabels(0, 0, new mutable.ArrayBuffer[String], new mutable.ArrayBuffer[Array[String]]) [ typeclass-derivation2a.scala:29 ]
| -> else if (labelsStr(cur) == elemSeparator) [ typeclass-derivation2a.scala:43 ]
-- Error: tests/run/typeclass-derivation2a.scala:32:22 -------------------------
32 | private final val caseSeparator = '\001'
| ^
|Access non-initialized field value caseSeparator. Calling trace:
| -> initLabels(0, 0, new mutable.ArrayBuffer[String], new mutable.ArrayBuffer[Array[String]]) [ typeclass-derivation2a.scala:29 ]
| -> else if (labelsStr(cur) == caseSeparator) [ typeclass-derivation2a.scala:41 ]
2 errors found1 parent 8904c96 commit a697514
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments