-
Notifications
You must be signed in to change notification settings - Fork 279
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: symmetric predicate check runs on empty type graph #1248
Conversation
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
Data
|
Codecov Report
@@ Coverage Diff @@
## main #1248 +/- ##
==========================================
- Coverage 63.45% 63.44% -0.02%
==========================================
Files 61 61
Lines 7170 7176 +6
Branches 1664 1667 +3
==========================================
+ Hits 4550 4553 +3
- Misses 2537 2540 +3
Partials 83 83
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Deploying with Cloudflare Pages
|
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.
Looks good! Although a little awkward to do a two-pass check, this is totally okay as a fix:
. The example seems to work well. Thanks!
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.
Ah clever! LGTM 👍
Description
Resolves #1110
Symmetric predicate declarations require that the two argument types,
T1
andT2
, are exactly equal. To check equality, we check thatT1
is a subtype ofT2
, and thatT2
is a subtype ofT1
. This is done by querying the subtype graph.The issue is that the checks are performed before the computation of the type graph. As an example,
This should fail, since T1 and T2 are not subtypes of each other. Indeed it does (correctly), but it also generates two errors in the browser console hidden from users that T2 is not in the subtype graph.
The overall behavior, exposed to the users, is actually correct, but the hidden error is bad.
This is because the complete type graph hasn't been generated yet.
Implementation strategy and design decisions
We delay the checking of the domain symmetric predicates until after the type graph has been generated. In other words, this is now the order of execution:
Examples with steps to reproduce them
Here
When we compile this in the previous version, it both yields an error, and outputs something to
console.error
.When we compile this in the new version, it yields an error, but no
console.error
output, which is good.Checklist