-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java CG: fix issue with seq binds in 'let be st'
- Loading branch information
Showing
4 changed files
with
97 additions
and
20 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
core/codegen/javagen/src/test/resources/complex_expressions/LetBeStExpSeqBind.vdmpp
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,16 @@ | ||
class Entry | ||
|
||
functions | ||
|
||
f : () -> nat | ||
f () == | ||
let m in seq [42] be st true | ||
in | ||
m; | ||
|
||
operations | ||
|
||
public static Run : () ==> nat | ||
Run () == f(); | ||
|
||
end Entry |
6 changes: 6 additions & 0 deletions
6
...odegen/javagen/src/test/resources/complex_expressions/LetBeStExpSeqBind.vdmpp.eval.result
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<testResult type="org.overture.codegen.tests.exec.ComplexExpJavaGenTest"> | ||
<result> | ||
<output object="rO0ABXNyAC9vcmcub3ZlcnR1cmUuaW50ZXJwcmV0ZXIudmFsdWVzLk5hdHVyYWxPbmVWYWx1ZQAAAAAAAAABAgAAeHIALG9yZy5vdmVydHVyZS5pbnRlcnByZXRlci52YWx1ZXMuTmF0dXJhbFZhbHVlAAAAAAAAAAECAAB4cgAsb3JnLm92ZXJ0dXJlLmludGVycHJldGVyLnZhbHVlcy5JbnRlZ2VyVmFsdWUAAAAAAAAAAQIAAUoAB2xvbmdWYWx4cgAtb3JnLm92ZXJ0dXJlLmludGVycHJldGVyLnZhbHVlcy5SYXRpb25hbFZhbHVlAAAAAAAAAAECAAB4cgApb3JnLm92ZXJ0dXJlLmludGVycHJldGVyLnZhbHVlcy5SZWFsVmFsdWUAAAAAAAAAAQIAAHhyACxvcmcub3ZlcnR1cmUuaW50ZXJwcmV0ZXIudmFsdWVzLk51bWVyaWNWYWx1ZQAAAAAAAAABAgABRAAFdmFsdWV4cgAlb3JnLm92ZXJ0dXJlLmludGVycHJldGVyLnZhbHVlcy5WYWx1ZQAAAAAAAAABAgAAeHBARQAAAAAAAAAAAAAAAAAq" resource="LetBeStExpSeqBind.vdmpp" value="42"/> | ||
</result> | ||
</testResult> |
38 changes: 38 additions & 0 deletions
38
core/codegen/javagen/src/test/resources/complex_expressions/LetBeStExpSeqBind.vdmpp.result
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,38 @@ | ||
|
||
import java.util.*; | ||
import org.overture.codegen.runtime.*; | ||
|
||
@SuppressWarnings("all") | ||
public class Entry { | ||
public static Number Run() { | ||
|
||
return f(); | ||
} | ||
|
||
public Entry() {} | ||
|
||
private static Number f() { | ||
|
||
Number letBeStExp_1 = null; | ||
Number m = null; | ||
Boolean success_1 = false; | ||
VDMSeq set_1 = SeqUtil.seq(42L); | ||
for (Iterator iterator_1 = set_1.iterator(); iterator_1.hasNext() && !(success_1); ) { | ||
m = ((Number) iterator_1.next()); | ||
success_1 = true; | ||
} | ||
if (!(success_1)) { | ||
throw new RuntimeException("Let Be St found no applicable bindings"); | ||
} | ||
|
||
letBeStExp_1 = m; | ||
return letBeStExp_1; | ||
} | ||
|
||
public String toString() { | ||
|
||
return "Entry{}"; | ||
} | ||
} | ||
|
||
########## |
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