Skip to content

Conversation

@flyingsilverfin
Copy link
Member

@flyingsilverfin flyingsilverfin commented Dec 21, 2025

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:

  • Integer is losslessly castable into Double or Decimal
  • Date is castable into Datetime (but not Datetime-tz)

This means lots of tests changed to require T:00:00 for datetime-tz values, and no longer allow doubles to be castable into decimal in our tests.

Comment on lines -194 to -196
| date | 2024-05-04 |
| datetime | 2024-05-04 |
| datetime-tz | 2024-05-04+0010 |
Copy link
Member Author

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?
Copy link
Member Author

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)

Copy link
Member Author

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 |
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant