From 0419bfbe6271c9c8fbbc8ec9f9285ef98922580a Mon Sep 17 00:00:00 2001 From: Daniel Sainati Date: Fri, 14 Jul 2023 10:46:23 -0400 Subject: [PATCH] respond to review --- runtime/sema/type.go | 6 ------ runtime/sema/type_tags.go | 17 ++++------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/runtime/sema/type.go b/runtime/sema/type.go index 720d2b4846..caddea0a40 100644 --- a/runtime/sema/type.go +++ b/runtime/sema/type.go @@ -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: diff --git a/runtime/sema/type_tags.go b/runtime/sema/type_tags.go index 9a53c8f6ae..bef99a388e 100644 --- a/runtime/sema/type_tags.go +++ b/runtime/sema/type_tags.go @@ -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) {