Skip to content

Commit 853ef55

Browse files
committed
optimize
1 parent 068b3b5 commit 853ef55

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Compiler/Checking/TypeRelations.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ let rec TypeFeasiblySubsumesType ndeep (g: TcGlobals) (amap: ImportMap) m (ty1:
137137

138138
let checkSubsumes ty1 ty2 =
139139
match ty1, ty2 with
140-
| TType_measure _, TType_measure _
141-
| TType_var _, _ | _, TType_var _ ->
142-
true
143-
144140
| TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 ->
145141
List.lengthsEqAndForall2 (TypesFeasiblyEquiv ndeep g amap m) l1 l2
146142

@@ -160,13 +156,17 @@ let rec TypeFeasiblySubsumesType ndeep (g: TcGlobals) (amap: ImportMap) m (ty1:
160156
// See if any interface in type hierarchy of ty2 is a supertype of ty1
161157
List.exists (TypeFeasiblySubsumesType (ndeep + 1) g amap m ty1 NoCoerce) interfaces
162158

163-
if g.langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache then
159+
match ty1, ty2 with
160+
| TType_measure _, TType_measure _
161+
| TType_var _, _ | _, TType_var _ ->
162+
true
163+
164+
| _ when g.langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache ->
164165
match TTypeCacheKey.TryGetFromStrippedTypes(ty1, ty2, canCoerce) with
165166
| ValueSome key ->
166167
(getTypeSubsumptionCache g).GetOrAdd(key, fun _ -> checkSubsumes ty1 ty2)
167168
| _ -> checkSubsumes ty1 ty2
168-
else
169-
checkSubsumes ty1 ty2
169+
| _ -> checkSubsumes ty1 ty2
170170

171171
and TypeFeasiblySubsumesTypeWithSupertypeCheck g amap m ndeep ty1 ty2 =
172172
match GetSuperTypeOfType g amap m ty2 with

0 commit comments

Comments
 (0)