Skip to content

Commit

Permalink
Remove IsSuperTypeOf from simple type
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrag00nv2 committed Oct 27, 2023
1 parent 3e3f169 commit 8a16ed2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion runtime/sema/simple_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type ValueIndexingInfo struct {
// SimpleType represents a simple nominal type.
type SimpleType struct {
ValueIndexingInfo ValueIndexingInfo
IsSuperTypeOf func(subType Type) bool
NestedTypes *StringTypeOrderedMap
memberResolvers map[string]MemberResolver
Members func(*SimpleType) map[string]MemberResolver
Expand Down
4 changes: 0 additions & 4 deletions runtime/sema/storable_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,4 @@ var StorableType = &SimpleType{
Comparable: false,
Exportable: false,
Importable: false,
IsSuperTypeOf: func(subType Type) bool {
storableResults := map[*Member]bool{}
return subType.IsStorable(storableResults)
},
}
10 changes: 4 additions & 6 deletions runtime/sema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -5729,6 +5729,10 @@ func checkSubTypeWithoutEquality(subType Type, superType Type) bool {
return IsSubType(subType, StoragePathType) ||
IsSubType(subType, CapabilityPathType)

case StorableType:
storableResults := map[*Member]bool{}
return subType.IsStorable(storableResults)

case CapabilityPathType:
return IsSubType(subType, PrivatePathType) ||
IsSubType(subType, PublicPathType)
Expand Down Expand Up @@ -6333,12 +6337,6 @@ func checkSubTypeWithoutEquality(subType Type, superType Type) bool {
}
}
}

case *SimpleType:
if typedSuperType.IsSuperTypeOf == nil {
return false
}
return typedSuperType.IsSuperTypeOf(subType)
}

// TODO: enforce type arguments, remove this rule
Expand Down

0 comments on commit 8a16ed2

Please sign in to comment.