Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Java --unicode-char mode coercion improvements #3630

Merged
merged 120 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
fd573f8
chore: Improve formatting
RustanLeino Sep 24, 2022
0593726
Change Array from a struct to an interface in Go
RustanLeino Sep 24, 2022
d398d89
fix: Cast to non-box type after let in Java
RustanLeino Sep 24, 2022
310fca6
fix: Comparison of arrays in JavaScript
RustanLeino Sep 24, 2022
9a5da01
fix: Add needed casts in C#
RustanLeino Sep 26, 2022
ed1c1d6
Add tests
RustanLeino Sep 24, 2022
06232a3
Improve EqualsGeneric for ArrayStruct
RustanLeino Sep 26, 2022
6dc48fc
Further improve NewValue…
RustanLeino Sep 26, 2022
37e7c2e
Add more tests
RustanLeino Sep 26, 2022
b7160e1
Improve NewArray… methods further
RustanLeino Sep 26, 2022
7e1adf7
Change “interface{}” to its alias “any” in Go
RustanLeino Sep 26, 2022
ca2205d
chore: Remove unused method
RustanLeino Sep 26, 2022
e6cb5b5
Remove a use of EmitArraySelectAsLvalue
RustanLeino Sep 26, 2022
91b44b3
Remove another use of EmitArraySelectAsLvalue
RustanLeino Sep 26, 2022
c3f810a
Make EmitArrayUpdate return RHS wr rather than take RHS as parameter
RustanLeino Sep 26, 2022
8fb3c25
Replace EmitArraySelectAsLvalue by ArrayLvalueImpl
RustanLeino Sep 26, 2022
a15454a
Replace ArrayIndex pointers with Set/Get
RustanLeino Sep 27, 2022
4b841ae
Remove unused runtime routines
RustanLeino Sep 27, 2022
254100f
Change dims() into dimensionCount()/dimensionLength()
RustanLeino Sep 27, 2022
3b9086c
Move Get1/Set1 into Array interface
RustanLeino Sep 27, 2022
af8c60d
Use ArraySet1 instead of ArrayUpdate
RustanLeino Sep 27, 2022
6bb4e63
Remove contents() from Array interface
RustanLeino Sep 27, 2022
e792511
fix: Print array-display size as given in program
RustanLeino Sep 28, 2022
bf6eeeb
Improve C# array-size run-time checking
RustanLeino Sep 28, 2022
a883bd8
Add exampleElement parameter to EmitNewArray
RustanLeino Sep 28, 2022
c12c102
Create Go arrays using example element
RustanLeino Sep 28, 2022
d8940f6
Add start parameter to CreateForLoop
RustanLeino Sep 28, 2022
8246df6
Change virtual EmitNewArray to take strings instead of Expressions
RustanLeino Sep 28, 2022
1482bfd
Rework new-array with init-funciton to support example
RustanLeino Sep 28, 2022
5bda65d
Add tests for more array types
RustanLeino Sep 28, 2022
7fbf35c
Add tests for 2-dimensional arrays
RustanLeino Sep 28, 2022
7cf4641
fix: Select tightest integer bound among IntBoundedPool’s
RustanLeino Sep 28, 2022
c1b5563
Clean up Array interface
RustanLeino Sep 28, 2022
de94752
Specialize array representation for byte and char
RustanLeino Sep 28, 2022
aebdbef
fix: Fix enumerations of long Java values
RustanLeino Sep 29, 2022
fe341f0
chore: Rename EmitExprAsInt to EmitExprAsNativeInt
RustanLeino Sep 30, 2022
669d189
chore: Add Type parameter to CreateIntLiteral/CreateDecrement
RustanLeino Sep 30, 2022
1631b31
Remove Type parameter from ArrayIndexToInt method
RustanLeino Sep 30, 2022
9e6655d
Add virtual ArrayIndexLiteral method
RustanLeino Sep 30, 2022
2a6b744
Add/improve comments
RustanLeino Sep 30, 2022
5007e25
Add virtual ExprToInt method
RustanLeino Sep 30, 2022
453aba3
fix: Don’t share inner arrays in arrays with 3 or more dimensions
RustanLeino Sep 30, 2022
fb1265d
Tidy up target types of array indices
RustanLeino Sep 30, 2022
452feb0
Reduce boxing across array Get/Set for byte/char
RustanLeino Sep 30, 2022
449eb02
Merge branch 'master' into go-array-refresh
RustanLeino Sep 30, 2022
2975fa8
Fix merge
RustanLeino Sep 30, 2022
df0536f
Add release notes
RustanLeino Sep 30, 2022
7529154
chore: Code improvements
RustanLeino Sep 30, 2022
1756f9a
Follow up on Python support from PR #2742
RustanLeino Sep 30, 2022
4d40379
Add other targets to test
RustanLeino Sep 30, 2022
5e4d38a
Merge branch 'master' into go-array-refresh
RustanLeino Sep 30, 2022
b389f2a
Update Source/DafnyCore/Compilers/Compiler-python.cs
RustanLeino Oct 10, 2022
57c77a3
Update Source/DafnyRuntime/DafnyRuntime.py
RustanLeino Oct 10, 2022
e947e0b
Update Source/DafnyRuntime/DafnyRuntime.py
RustanLeino Oct 10, 2022
a9f57b8
Update Source/DafnyRuntime/DafnyRuntime.py
RustanLeino Oct 10, 2022
83c200d
Update Source/DafnyRuntime/DafnyRuntime.py
RustanLeino Oct 10, 2022
23c6040
Act on reviewer comments for Python
RustanLeino Oct 10, 2022
dea64da
Merge branch 'master' into go-array-refresh
RustanLeino Oct 10, 2022
8b34ea0
Fix code formatting
RustanLeino Oct 10, 2022
723dd86
Reverse use of “any” to the older “interface{}” in Go
RustanLeino Oct 26, 2022
a4acb70
Merge branch 'master' into go-array-refresh
RustanLeino Oct 26, 2022
5aa8360
Merge branch 'master' into go-array-refresh
RustanLeino Nov 24, 2022
43947ed
Merge branch 'master' into go-array-refresh
RustanLeino Nov 29, 2022
f341c12
Merge branch 'master' into go-array-refresh
RustanLeino Nov 29, 2022
855627f
Change a last occurrence of “any” to “interface{}” for Go
RustanLeino Nov 29, 2022
71e791a
Merge branch 'master' into go-array-refresh
RustanLeino Dec 15, 2022
82399d9
Mention a fixed issue
RustanLeino Dec 16, 2022
e96af9b
Add tests for another fixed issue
RustanLeino Dec 16, 2022
84137fb
Point out file issue in a test file
RustanLeino Dec 16, 2022
9015d2f
Merge branch 'master' into go-array-refresh
RustanLeino Dec 16, 2022
362dbe9
Act on PR comments
RustanLeino Dec 16, 2022
a5d2c22
Merge branch 'master' into go-array-refresh
RustanLeino Dec 16, 2022
f9349af
Optimize Go arrays for CodePoint
RustanLeino Dec 16, 2022
a2d8340
fix: Type descriptors and default values of Unicode char for C#
RustanLeino Dec 17, 2022
e842bfc
fix: Default value of unicode char for JavaScript
RustanLeino Dec 17, 2022
e5ee2aa
Big cop-out: Java unicode boxing/unboxing not yet working
RustanLeino Dec 17, 2022
b9b7831
Some unicode fixes, and giving up on Java and Python
RustanLeino Dec 17, 2022
5069cee
Merge branch 'master' into go-array-refresh
RustanLeino Dec 17, 2022
027e17c
Export only Array, not ArrayStruct, ArrayForByte, …
RustanLeino Dec 19, 2022
8cc0b87
Merge branch 'master' into go-array-refresh
RustanLeino Dec 19, 2022
3a8c6fe
Merge branch 'master' into go-array-refresh
robin-aws Jan 6, 2023
6835539
Ensure isStr inference is disabled in more cases for —unicode-char in…
robin-aws Jan 8, 2023
93720cc
Merge branch 'go-array-refresh' of github.com:RustanLeino/dafny into …
robin-aws Jan 8, 2023
1f3351b
Fix default value for unicode char subset types in Java
robin-aws Jan 8, 2023
39c7cd1
Switch test case to TestDafny and disable fail-fast behavior
robin-aws Jan 8, 2023
c3b63c4
Add a couple of missing CodePoint coersions in Java
robin-aws Jan 14, 2023
5bc391f
More missing coersions, and coerse char subset types too
robin-aws Jan 15, 2023
848ca8e
Another case, clean up
robin-aws Jan 15, 2023
181cf4a
Java arrow conversions (mostly) implemented
robin-aws Jan 16, 2023
3522080
Merge branch 'master' into go-array-refresh
atomb Jan 17, 2023
7f196b0
More coercions
robin-aws Jan 18, 2023
927eb6f
Revert unnecessary change, beef up Comma
robin-aws Jan 18, 2023
ce63b79
Fix default value for char-based type descriptors
robin-aws Jan 18, 2023
bcd2f04
Enabling Python in —unicode-char versino of Arrays.dfy
robin-aws Jan 19, 2023
0353ee3
Merge branch 'master' into go-array-refresh
robin-aws Jan 19, 2023
beb822a
Merge branch 'go-array-refresh' into java-unicode-char-improvements
robin-aws Jan 19, 2023
32cbe91
Merge branch 'master' of https://github.com/dafny-lang/dafny into jav…
robin-aws Feb 21, 2023
6f1ab18
fix bad merges
robin-aws Feb 21, 2023
fce2849
Removing comments/dead code
robin-aws Feb 22, 2023
6a4e80b
Another bad merge
robin-aws Feb 22, 2023
50ca34f
Coerce to bound variable type (not dtor type which might be a type pa…
robin-aws Feb 23, 2023
8a611d0
Update metatest for TestDafny
robin-aws Feb 24, 2023
77eef05
Be more selective with eta conversion fix
robin-aws Feb 24, 2023
1e6afcf
Merge branch 'master' of https://github.com/dafny-lang/dafny into jav…
robin-aws Feb 24, 2023
c77944b
whitespace
robin-aws Feb 24, 2023
691e9f5
Handle coercions in foreach loops and collection operations
robin-aws Feb 24, 2023
81ccb19
Handle coercions in lambdas
robin-aws Feb 25, 2023
e7d08f9
Define static CodePoint.hashCode() method our compiler expects
robin-aws Feb 25, 2023
40fb615
Handling converting from uint to Rune
robin-aws Feb 25, 2023
5725ee2
Missing change from last commit, plus forking tests
robin-aws Feb 25, 2023
dfd44ba
Fix char quantification in Java
robin-aws Feb 25, 2023
8e38ef1
Merge branch 'master' into java-unicode-char-improvements
robin-aws Feb 25, 2023
8c03820
Batch of PR feedback
robin-aws Feb 26, 2023
f7d5fb9
Merge branch 'java-unicode-char-improvements' of github.com:robin-aws…
robin-aws Feb 26, 2023
4ede89f
Merge branch 'master' into java-unicode-char-improvements
robin-aws Feb 26, 2023
b502d08
Update verified count in test
robin-aws Feb 26, 2023
9206512
Better name
robin-aws Feb 26, 2023
50341ce
Another (somewhat) better name
robin-aws Feb 26, 2023
d387cef
Merge branch 'java-unicode-char-improvements' of github.com:robin-aws…
robin-aws Feb 26, 2023
f82c0d9
whitespace
robin-aws Feb 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Source/DafnyCore/Compilers/CSharp/Compiler-Csharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2874,6 +2874,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
out bool reverseArguments,
out bool truncateResult,
out bool convertE1_to_int,
out bool coerceE1,
ConcreteSyntaxTree errorWr) {

opString = null;
Expand All @@ -2884,6 +2885,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
reverseArguments = false;
truncateResult = false;
convertE1_to_int = false;
coerceE1 = false;

switch (op) {
case BinaryExpr.ResolvedOpcode.EqCommon: {
Expand Down Expand Up @@ -3015,7 +3017,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,

default:
base.CompileBinOp(op, e0, e1, tok, resultType,
out opString, out preOpString, out postOpString, out callString, out staticCallString, out reverseArguments, out truncateResult, out convertE1_to_int,
out opString, out preOpString, out postOpString, out callString, out staticCallString, out reverseArguments, out truncateResult, out convertE1_to_int, out coerceE1,
errorWr);
break;
}
Expand All @@ -3037,8 +3039,14 @@ protected override void EmitConversionExpr(ConversionExpr e, bool inLetExprBody,
ConvertFromChar(e.E, wr, inLetExprBody, wStmts);
wr.Write(", BigInteger.One)");
} else if (e.ToType.IsCharType) {
wr.Write($"({CharTypeName})");
TrParenExpr(e.E, wr, inLetExprBody, wStmts);
if (UnicodeCharEnabled) {
wr.Write($"new {CharTypeName}((int)");
TrParenExpr(e.E, wr, inLetExprBody, wStmts);
wr.Write(")");
} else {
wr.Write($"({CharTypeName})");
TrParenExpr(e.E, wr, inLetExprBody, wStmts);
}
} else {
// (int or bv or char) -> (int or bv or ORDINAL)
var fromNative = AsNativeType(e.E.Type);
Expand Down
2 changes: 2 additions & 0 deletions Source/DafnyCore/Compilers/Cplusplus/Compiler-cpp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
out bool reverseArguments,
out bool truncateResult,
out bool convertE1_to_int,
out bool coerceE1,
ConcreteSyntaxTree errorWr) {

opString = null;
Expand All @@ -2063,6 +2064,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
reverseArguments = false;
truncateResult = false;
convertE1_to_int = false;
coerceE1 = false;

switch (op) {
case BinaryExpr.ResolvedOpcode.Iff:
Expand Down
2 changes: 2 additions & 0 deletions Source/DafnyCore/Compilers/Dafny/Compiler-dafny.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
out bool reverseArguments,
out bool truncateResult,
out bool convertE1_to_int,
out bool coerceE1,
ConcreteSyntaxTree errorWr) {

opString = null;
Expand All @@ -539,6 +540,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
reverseArguments = false;
truncateResult = false;
convertE1_to_int = false;
coerceE1 = false;

switch (op) {
case BinaryExpr.ResolvedOpcode.Iff:
Expand Down
6 changes: 4 additions & 2 deletions Source/DafnyCore/Compilers/GoLang/Compiler-go.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
out bool reverseArguments,
out bool truncateResult,
out bool convertE1_to_int,
out bool coerceE1,
ConcreteSyntaxTree errorWr) {

opString = null;
Expand All @@ -3124,6 +3125,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,
reverseArguments = false;
truncateResult = false;
convertE1_to_int = false;
coerceE1 = false;

switch (op) {
case BinaryExpr.ResolvedOpcode.BitwiseAnd:
Expand Down Expand Up @@ -3368,7 +3370,7 @@ protected override void CompileBinOp(BinaryExpr.ResolvedOpcode op,

default:
base.CompileBinOp(op, e0, e1, tok, resultType,
out opString, out preOpString, out postOpString, out callString, out staticCallString, out reverseArguments, out truncateResult, out convertE1_to_int,
out opString, out preOpString, out postOpString, out callString, out staticCallString, out reverseArguments, out truncateResult, out convertE1_to_int, out coerceE1,
errorWr);
break;
}
Expand Down Expand Up @@ -3659,7 +3661,7 @@ protected override void EmitCollectionDisplay(CollectionType ct, IToken tok, Lis
wr.Write("_dafny.SeqOf");
}
}
TrExprList(elements, wr, inLetExprBody, wStmts, type: ct.TypeArgs[0]);
TrExprList(elements, wr, inLetExprBody, wStmts, typeAt: _ => ct.TypeArgs[0]);
}

protected override void EmitMapDisplay(MapType mt, IToken tok, List<ExpressionPair> elements,
Expand Down
Loading