Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit941d05c

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
Optimize unnecessary checks when computing overloads (#4971)
* do not check if non-abstract class members are implemented in object expression* optimize ApplyAbstractSlotInference on huge number of overloads* rename
1 parent2db96a1 commit941d05c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

‎src/fsharp/MethodOverrides.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ module DispatchSlotChecking =
273273
sink|> ignore
274274
()
275275
|[]->
276-
ifnot isOptional&&
276+
ifnot isOptional&&
277277
// Check that no available prior override implements this dispatch slot
278278
not(DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed dispatchSlot)
279279
then
@@ -475,7 +475,7 @@ module DispatchSlotChecking =
475475
// So here we get and yield all of those.
476476
for minfoin reqdTy|> GetIntrinsicMethInfosOfType infoReader(None,AccessibleFromSomewhere,AllowMultiIntfInstantiations.Yes) IgnoreOverrides reqdTyRangedo
477477
if minfo.IsDispatchSlotthen
478-
yield RequiredSlot(minfo,(*isOptional=*)false)]
478+
yield RequiredSlot(minfo,(*isOptional=*)not minfo.IsAbstract)]
479479

480480

481481
// Compute the methods that are available to implement abstract slots from the base class

‎src/fsharp/TypeChecker.fs‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10847,7 +10847,12 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy
1084710847
if memberFlags.IsOverrideOrExplicitImpl then
1084810848

1084910849
// for error detection, we want to compare finality when testing for equivalence
10850-
let makeUniqueBySig meths = meths |> ListSet.setify (MethInfosEquivByNameAndSig EraseNone false cenv.g cenv.amap m)
10850+
let methInfosEquivByNameAndSig meths =
10851+
match meths with
10852+
| [] -> false
10853+
| head :: tail ->
10854+
tail |> List.forall (MethInfosEquivByNameAndSig EraseNone false cenv.g cenv.amap m head)
10855+
1085110856
match memberFlags.MemberKind with
1085210857
| MemberKind.Member ->
1085310858
let dispatchSlots, dispatchSlotsArityMatch =
@@ -10861,11 +10866,11 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy
1086110866

1086210867
| slots ->
1086310868
match dispatchSlotsArityMatch with
10864-
| meths whenmeths |> makeUniqueBySig |> isSingleton -> meths
10869+
| meths whenmethInfosEquivByNameAndSig meths -> meths
1086510870
| [] ->
1086610871
let details =
1086710872
slots
10868-
|>List.map (NicePrint.stringOfMethInfo cenv.amap m envinner.DisplayEnv)
10873+
|>Seq.map (NicePrint.stringOfMethInfo cenv.amap m envinner.DisplayEnv)
1086910874
|> Seq.map (sprintf "%s %s" System.Environment.NewLine)
1087010875
|> String.concat ""
1087110876

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp