Skip to content

Commit a6b3c55

Browse files
dsymebaronfel
authored andcommitted
try simplify type logic
1 parent fd48ebf commit a6b3c55

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/fsharp/PostInferenceChecks.fs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,9 @@ let CheckMultipleInterfaceInstantiations cenv (typ:TType) (interfaces:TType list
724724
match firstInterfaceWithMultipleGenericInstantiations with
725725
| None -> ()
726726
| Some (typ1, typ2) ->
727-
errorR(Error(FSComp.SR.chkMultipleGenericInterfaceInstantiations((NicePrint.minimalStringOfType cenv.denv typ1), (NicePrint.minimalStringOfType cenv.denv typ2)), m))
727+
let typ1Str = NicePrint.minimalStringOfType cenv.denv typ1
728+
let typ2Str = NicePrint.minimalStringOfType cenv.denv typ2
729+
errorR(Error(FSComp.SR.chkMultipleGenericInterfaceInstantiations(typ1Str, typ2Str), m))
728730
else
729731
let groups = interfaces |> List.groupBy keyf
730732
let errors = seq {
@@ -734,19 +736,17 @@ let CheckMultipleInterfaceInstantiations cenv (typ:TType) (interfaces:TType list
734736
let typ1 = items.[i1]
735737
let typ2 = items.[i2]
736738
let tcRef1 = tcrefOfAppTy cenv.g typ1
737-
if tyconRefEq cenv.g tcRef1 (tcrefOfAppTy cenv.g typ2) then
738-
// same nominal type -> check generic args
739-
match compareTypesWithRegardToTypeVariablesAndMeasures cenv.g cenv.amap m typ1 typ2 with
740-
| ExactlyEqual -> () // exact duplicates are checked in another place
741-
| FeasiblyEqual ->
742-
let typ1Str = NicePrint.minimalStringOfType cenv.denv typ1
743-
let typ2Str = NicePrint.minimalStringOfType cenv.denv typ2
744-
if isObjectExpression then
745-
yield (Error(FSComp.SR.typrelInterfaceWithConcreteAndVariableObjectExpression(tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m))
746-
else
747-
let typStr = NicePrint.minimalStringOfType cenv.denv typ
748-
yield (Error(FSComp.SR.typrelInterfaceWithConcreteAndVariable(typStr, tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m))
749-
| NotEqual -> ()
739+
match compareTypesWithRegardToTypeVariablesAndMeasures cenv.g cenv.amap m typ1 typ2 with
740+
| ExactlyEqual -> () // exact duplicates are checked in another place
741+
| FeasiblyEqual ->
742+
let typ1Str = NicePrint.minimalStringOfType cenv.denv typ1
743+
let typ2Str = NicePrint.minimalStringOfType cenv.denv typ2
744+
if isObjectExpression then
745+
yield (Error(FSComp.SR.typrelInterfaceWithConcreteAndVariableObjectExpression(tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m))
746+
else
747+
let typStr = NicePrint.minimalStringOfType cenv.denv typ
748+
yield (Error(FSComp.SR.typrelInterfaceWithConcreteAndVariable(typStr, tcRef1.DisplayNameWithStaticParametersAndUnderscoreTypars, typ1Str, typ2Str),m))
749+
| NotEqual -> ()
750750
}
751751
match Seq.tryHead errors with
752752
| None -> ()

0 commit comments

Comments
 (0)