-
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
Include and consider static types of arrays and dictionaries #1043
Include and consider static types of arrays and dictionaries #1043
Conversation
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!
I added a couple of suggestions, but not blockers for this PR. So I'll go ahead and merge this 👍
@@ -119,8 +120,14 @@ func (t CompositeDynamicType) IsImportable() bool { | |||
|
|||
// DictionaryDynamicType | |||
|
|||
type DictionaryStaticTypeEntry struct { |
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.
type DictionaryStaticTypeEntry struct { | |
type DictionaryDynamicTypeEntry struct { |
subTypeStaticType := interpreter.ConvertStaticToSemaType(typedSubType.StaticType) | ||
if !sema.IsSubType(subTypeStaticType, typedSuperType) { | ||
return false | ||
} |
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.
Once the runtime mutability checks (checking the type of array/dictionary before insertions) are added, I think we can rely only on this check, and maybe don't need to check both the static type and the dynamic type. Because that 'mutability checks on insertions' ensures that any value within the container is a subtype of the static type.
Work towards #870
Description
master
branchFiles changed
in the Github PR explorer