-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/export: export floats as float literals
This avoids round-tripping problems when floats can be represented as integers. Fixes #896 The real solution is probably to make integer a direct subclass of float. This, however, is a far more substantial change. See #253. Change-Id: I1fa532677a4ba2dcbe85446fcd7134f5bc3a542d Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9381 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]>
- Loading branch information
Showing
5 changed files
with
128 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
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,86 @@ | ||
-- in.cue -- | ||
import "strings" | ||
|
||
floats: { | ||
a: 3. | ||
b: float & 3. | ||
} | ||
numbers: { | ||
a: number | ||
a: 3 | ||
b: number | ||
b: 3. | ||
} | ||
-- out/definition -- | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
-- out/doc -- | ||
[] | ||
[floats] | ||
[floats a] | ||
[floats b] | ||
[numbers] | ||
[numbers a] | ||
[numbers b] | ||
-- out/value -- | ||
== Simplified | ||
{ | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
} | ||
== Raw | ||
{ | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
} | ||
== Final | ||
{ | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
} | ||
== All | ||
{ | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
} | ||
== Eval | ||
{ | ||
floats: { | ||
a: 3.0 | ||
b: 3.0 | ||
} | ||
numbers: { | ||
a: 3 | ||
b: 3.0 | ||
} | ||
} |
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