The Recur module includes some fairly complex type constraints with comments inline for clarity, eg.
until: (
* DateTime(
// if dtstart is defined and a datetime, until must also be a datetime if defined
dtstart?.ifNonNull((it) -> it is DateTime) ?? true,
dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true,
utc.implies(tzid == null)
)
|Date(
// if dtstart is defined and a date, until must also be a date if defined
dtstart?.ifNonNull((it) -> it is Date) ?? true,
tzid == null
)
)?
If non of these constraints can be satisfied, eg. by input such as
import "@icalendar/Recur.pkl"
result = new Recur {
tzid = "America/Los_Angeles"
freq = "YEARLY"
until = DateTime.DateTime("20250101T000000Z")
}.toString()
Then the resulting error message will include the full original code with only newlines stripped:
Expected value of type `* DateTime( // if dtstart is defined and a datetime, until must also be a datetime if defined dtstart?.ifNonNull((it) -> it is DateTime) ?? true, dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true, utc.implies(tzid == null) ) |Date( // if dtstart is defined and a date, until must also be a date if defined dtstart?.ifNonNull((it) -> it is Date) ?? true, tzid == null )`, but got a different `icalendar.DateTime`. Value: new ModuleClass { date = ?; time { h = ?; m = ?; s = ?; utc = true }; utc = t...
Ideally this should produce output with the type/constraints canonically formatted, eg. (without addition of newlines for line length)
Expected value of type `*DateTime(dtstart?.ifNonNull((it) -> it is DateTime) ?? true, dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true, utc.implies(tzid == null))|Date(dtstart?.ifNonNull((it) -> it is Date) ?? true, tzid == null)`, but got a different `icalendar.DateTime`. Value: new ModuleClass { date = ?; time { h = ?; m = ?; s = ?; utc = true }; utc = t...
Originally created by @HT154 on GitHub (Mar 21, 2025).
Noticed this while testing out https://github.com/apple/pkl-pantry/pull/105
The `Recur` module includes some fairly complex type constraints with comments inline for clarity, eg.
```pkl
until: (
* DateTime(
// if dtstart is defined and a datetime, until must also be a datetime if defined
dtstart?.ifNonNull((it) -> it is DateTime) ?? true,
dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true,
utc.implies(tzid == null)
)
|Date(
// if dtstart is defined and a date, until must also be a date if defined
dtstart?.ifNonNull((it) -> it is Date) ?? true,
tzid == null
)
)?
```
If non of these constraints can be satisfied, eg. by input such as
```pkl
import "@icalendar/Recur.pkl"
result = new Recur {
tzid = "America/Los_Angeles"
freq = "YEARLY"
until = DateTime.DateTime("20250101T000000Z")
}.toString()
```
Then the resulting error message will include the full original code with only newlines stripped:
```
Expected value of type `* DateTime( // if dtstart is defined and a datetime, until must also be a datetime if defined dtstart?.ifNonNull((it) -> it is DateTime) ?? true, dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true, utc.implies(tzid == null) ) |Date( // if dtstart is defined and a date, until must also be a date if defined dtstart?.ifNonNull((it) -> it is Date) ?? true, tzid == null )`, but got a different `icalendar.DateTime`. Value: new ModuleClass { date = ?; time { h = ?; m = ?; s = ?; utc = true }; utc = t...
```
Ideally this should produce output with the type/constraints [canonically formatted](https://github.com/apple/pkl-evolution/pull/15), eg. (without addition of newlines for line length)
```
Expected value of type `*DateTime(dtstart?.ifNonNull((it) -> it is DateTime) ?? true, dtstart?.ifNonNull((it) -> utc == (it as DateTime).utc) ?? true, utc.implies(tzid == null))|Date(dtstart?.ifNonNull((it) -> it is Date) ?? true, tzid == null)`, but got a different `icalendar.DateTime`. Value: new ModuleClass { date = ?; time { h = ?; m = ?; s = ?; utc = true }; utc = t...
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @HT154 on GitHub (Mar 21, 2025).
Noticed this while testing out https://github.com/apple/pkl-pantry/pull/105
The
Recurmodule includes some fairly complex type constraints with comments inline for clarity, eg.If non of these constraints can be satisfied, eg. by input such as
Then the resulting error message will include the full original code with only newlines stripped:
Ideally this should produce output with the type/constraints canonically formatted, eg. (without addition of newlines for line length)