Skip to content

Commit

Permalink
respond to review
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed Jul 14, 2023
1 parent 1080756 commit 0419bfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
6 changes: 0 additions & 6 deletions runtime/sema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -6175,12 +6175,6 @@ func checkSubTypeWithoutEquality(subType Type, superType Type) bool {
return true

case *IntersectionType:
// `Any` is never a subtype of a intersection type
switch subType {
case AnyResourceType, AnyStructType, AnyType:
return false
}

switch typedSubType := subType.(type) {
case *IntersectionType:

Expand Down
17 changes: 4 additions & 13 deletions runtime/sema/type_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,24 +927,15 @@ func commonSuperTypeOfComposites(types []Type) Type {
}
}

var superType Type
if hasResources {
superType = AnyResourceType
} else {
superType = AnyStructType
}

if hasCommonInterface {
if len(commonInterfacesList) == 0 {
panic(errors.NewUnreachableError())
}

return &IntersectionType{
Types: commonInterfacesList,
}
} else if hasResources {
return AnyResourceType
} else {
return AnyStructType
}

return superType
}

func unwrapOptionals(types []Type) ([]Type, int) {
Expand Down

0 comments on commit 0419bfb

Please sign in to comment.