-
Notifications
You must be signed in to change notification settings - Fork 20
Test castable value types for annotations #395
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
base: 2025-christmas
Are you sure you want to change the base?
Test castable value types for annotations #395
Conversation
| | date | 2024-05-04 | | ||
| | datetime | 2024-05-04 | | ||
| | datetime-tz | 2024-05-04+0010 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BDD parser has been updated in Core - and TypeQL doesn't allow eliding the T00:00 from timezone-datetimes. If you have a datetime, you can accept a literal without T00:00, since it's parsed as a DateLiteral, which is trivially castable to datetime.
| | decimal | 0.0dec..100.0dec | integer | 150 | 50 | | ||
| | decimal | 0.0dec..100.0dec | integer | -10 | 0 | | ||
| | decimal | 0.0dec..100.0dec | integer | 101 | 100 | | ||
| # TODO decimals and doubles don't go cleanly into integers, so that isn't allowed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@range value arguments should be exactly the right types, or trivially castable - not sometimes castable (eg. some doubles go into integer, and some decimals go into integer, but not always)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we all agree, will delete this set of test rows
| | double | 0.01 | 0.1 | 0.01 | | ||
| | double | 0.01, 0.0001 | 0.001 | 0.0001 | | ||
| | double | 0.01, 0.0001 | 1.0 | 0.01 | | ||
| | decimal | -8.0, 88.3, 0.001 | 0.01 | 0.001 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: double is not always castable into decimal, so we require using the decimal or integer syntax
Usage and product changes
We add tests for using castable value types for setting @value and @range annotations. We now align to the behaviour that:
Annotation arguments must match value type exactly, or be losslessly castable values:
This means lots of tests changed to require
T:00:00fordatetime-tzvalues, and no longer allow doubles to be castable intodecimalin our tests.