-
Notifications
You must be signed in to change notification settings - Fork 140
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
Extend subtyping rule for restricted type #1480
Conversation
Added another test case which shows that this is not just a problem for references, but an issue with composite dynamic type and restricted static type. |
Added yet another check which shows that this is actually a limitation of the type checker. The dynamic subtype check in the interpreter relies on this check to succeed |
require.ErrorAs(t, err, &interpreter.ValueTransferTypeError{}) | ||
}) | ||
|
||
t.Run("contract and restricted type", func(t *testing.T) { |
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.
These tests passed the type checking (correctly) and only failed at run-time due to the defensive value transfer check, which in addition to the static check, also checks subtyping for the underlying value.
Codecov Report
@@ Coverage Diff @@
## v0.23 #1480 +/- ##
=======================================
Coverage 75.98% 75.98%
=======================================
Files 283 283
Lines 36993 36993
=======================================
+ Hits 28108 28109 +1
+ Misses 7612 7611 -1
Partials 1273 1273
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Closes #1479
Description
When checking
T <: U{Vs}
, we currently requireT == U
, assuming both are composite values.However, the latter may actually be a type requirement.
Extend the subtyping check and require
T <: U
.master
branchFiles changed
in the Github PR explorer