@@ -441,10 +441,10 @@ module TcRecdUnionAndEnumDeclarations =
441
441
442
442
let isThreadStatic = isThreadOrContextStatic g attrsForField
443
443
if isThreadStatic && ( not zeroInit || not isStatic) then
444
- error ( Error( FSComp.SR.tcThreadStaticAndContextStaticMustBeStatic(), m))
444
+ errorR ( Error( FSComp.SR.tcThreadStaticAndContextStaticMustBeStatic(), m))
445
445
446
446
if isVolatile then
447
- error ( Error( FSComp.SR.tcVolatileOnlyOnClassLetBindings(), m))
447
+ errorR ( Error( FSComp.SR.tcVolatileOnlyOnClassLetBindings(), m))
448
448
449
449
if isIncrClass && ( not zeroInit || not isMutable) then errorR( Error( FSComp.SR.tcUninitializedValFieldsMustBeMutable(), m))
450
450
let isPrivate = match vis with | Some ( SynAccess.Private _) -> true | _ -> false
@@ -566,7 +566,7 @@ module TcRecdUnionAndEnumDeclarations =
566
566
MakeRecdFieldSpec g env parent ( false , None, argTy, [], [], id, argInfo.Name.IsNone, false , false , XmlDoc.Empty, None, m))
567
567
568
568
if not ( typeEquiv g recordTy thisTy) then
569
- error ( Error( FSComp.SR.tcReturnTypesForUnionMustBeSameAsType(), m))
569
+ errorR ( Error( FSComp.SR.tcReturnTypesForUnionMustBeSameAsType(), m))
570
570
rfields, recordTy
571
571
572
572
let names = rfields
@@ -756,10 +756,10 @@ let TcOpenTypeDecl (cenv: cenv) mOpenDecl scopem env (synType: SynType, m) =
756
756
let ty , _tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurrence.Open WarnOnIWSAM.Yes env emptyUnscopedTyparEnv synType
757
757
758
758
if not ( isAppTy g ty) then
759
- error ( Error( FSComp.SR.tcNamedTypeRequired( " open type" ), m))
759
+ errorR ( Error( FSComp.SR.tcNamedTypeRequired( " open type" ), m))
760
760
761
761
if isByrefTy g ty then
762
- error ( Error( FSComp.SR.tcIllegalByrefsInOpenTypeDeclaration(), m))
762
+ errorR ( Error( FSComp.SR.tcIllegalByrefsInOpenTypeDeclaration(), m))
763
763
764
764
let openDecl = OpenDeclaration.Create ( SynOpenDeclTarget.Type ( synType, m), [], [ ty], scopem, false )
765
765
let env = OpenTypeContent cenv.tcSink g cenv.amap scopem env ty openDecl
@@ -1065,11 +1065,11 @@ module MutRecBindingChecking =
1065
1065
1066
1066
if tcref.IsTypeAbbrev then
1067
1067
// ideally we'd have the 'm' of the type declaration stored here, to avoid needing to trim to line to approx
1068
- error ( Error( FSComp.SR.tcTypeAbbreviationsMayNotHaveMembers(), ( trimRangeToLine m)))
1068
+ errorR ( Error( FSComp.SR.tcTypeAbbreviationsMayNotHaveMembers(), ( trimRangeToLine m)))
1069
1069
1070
1070
if tcref.IsEnumTycon && ( declKind <> ExtrinsicExtensionBinding) && classMemberDef.IsSome then
1071
1071
// ideally we'd have the 'm' of the type declaration stored here, to avoid needing to trim to line to approx
1072
- error ( Error( FSComp.SR.tcEnumerationsMayNotHaveMembers(), ( trimRangeToLine m)))
1072
+ errorR ( Error( FSComp.SR.tcEnumerationsMayNotHaveMembers(), ( trimRangeToLine m)))
1073
1073
1074
1074
match classMemberDef, containerInfo with
1075
1075
@@ -1086,7 +1086,7 @@ module MutRecBindingChecking =
1086
1086
let ( MemberOrValContainerInfo ( tcref , _ , baseValOpt , safeInitInfo , _ )) = memberContainerInfo
1087
1087
1088
1088
if tcref.TypeOrMeasureKind = TyparKind.Measure then
1089
- error ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1089
+ errorR ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1090
1090
1091
1091
// Phase2A: make staticCtorInfo - ctorv, thisVal etc, type depends on argty(s)
1092
1092
let staticCtorInfo = TcStaticImplicitCtorInfo_ Phase2A( cenv, envForTycon, tcref, m, copyOfTyconTypars)
@@ -1102,7 +1102,7 @@ module MutRecBindingChecking =
1102
1102
1103
1103
| Some ( SynMemberDefn.ImplicitInherit ( ty, arg, _ baseIdOpt, m, _)), _ ->
1104
1104
if tcref.TypeOrMeasureKind = TyparKind.Measure then
1105
- error ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1105
+ errorR ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1106
1106
1107
1107
// Phase2A: inherit ty(arg) as base - pass through
1108
1108
// Phase2A: pick up baseValOpt!
@@ -1112,7 +1112,7 @@ module MutRecBindingChecking =
1112
1112
1113
1113
| Some ( SynMemberDefn.LetBindings ( letBinds, isStatic, isRec, m)), _ ->
1114
1114
match tcref.TypeOrMeasureKind, isStatic with
1115
- | TyparKind.Measure, false -> error ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1115
+ | TyparKind.Measure, false -> errorR ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1116
1116
| _ -> ()
1117
1117
1118
1118
if not isStatic && tcref.IsStructOrEnumTycon then
@@ -1149,9 +1149,9 @@ module MutRecBindingChecking =
1149
1149
match memberFlagsOpt with
1150
1150
| None -> ()
1151
1151
| Some memberFlags ->
1152
- if memberFlags.IsInstance then error ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1152
+ if memberFlags.IsInstance then errorR ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembers(), m))
1153
1153
match memberFlags.MemberKind with
1154
- | SynMemberKind.Constructor -> error ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembersNotConstructors(), m))
1154
+ | SynMemberKind.Constructor -> errorR ( Error( FSComp.SR.tcMeasureDeclarationsRequireStaticMembersNotConstructors(), m))
1155
1155
| _ -> ()
1156
1156
1157
1157
let envForMember =
@@ -1880,7 +1880,7 @@ module MutRecBindingChecking =
1880
1880
for extraTypar in allExtraGeneralizableTypars do
1881
1881
if Zset.memberOf freeInInitialEnv extraTypar then
1882
1882
let ty = mkTyparTy extraTypar
1883
- error ( Error( FSComp.SR.tcNotSufficientlyGenericBecauseOfScope( NicePrint.prettyStringOfTy denv ty), extraTypar.Range))
1883
+ errorR ( Error( FSComp.SR.tcNotSufficientlyGenericBecauseOfScope( NicePrint.prettyStringOfTy denv ty), extraTypar.Range))
1884
1884
1885
1885
// Solve any type variables in any part of the overall type signature of the class whose
1886
1886
// constraints involve generalized type variables.
@@ -1980,8 +1980,8 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
1980
1980
| SynMemberDefn.Interface( interfaceType= intfTy; members= defnOpt) ->
1981
1981
let ty = if tcref.Deref.IsFSharpException then g.exn_ ty else generalizedTyconRef g tcref
1982
1982
let m = intfTy.Range
1983
- if tcref.IsTypeAbbrev then error ( Error( FSComp.SR.tcTypeAbbreviationsCannotHaveInterfaceDeclaration(), m))
1984
- if tcref.IsEnumTycon then error ( Error( FSComp.SR.tcEnumerationsCannotHaveInterfaceDeclaration(), m))
1983
+ if tcref.IsTypeAbbrev then errorR ( Error( FSComp.SR.tcTypeAbbreviationsCannotHaveInterfaceDeclaration(), m))
1984
+ if tcref.IsEnumTycon then errorR ( Error( FSComp.SR.tcEnumerationsCannotHaveInterfaceDeclaration(), m))
1985
1985
1986
1986
let intfTyR =
1987
1987
let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTyconTypars envForTycon
@@ -2053,7 +2053,7 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
2053
2053
| SynMemberDefn.AbstractSlot _
2054
2054
| SynMemberDefn.ValField _
2055
2055
| SynMemberDefn.Inherit _ -> error( InternalError( " Unexpected declaration element" , memb.Range))
2056
- | SynMemberDefn.NestedType _ -> error ( Error( FSComp.SR.tcTypesCannotContainNestedTypes(), memb.Range)) ]
2056
+ | SynMemberDefn.NestedType _ -> errorR ( Error( FSComp.SR.tcTypesCannotContainNestedTypes(), memb.Range)) ]
2057
2057
2058
2058
let tpenv = emptyUnscopedTyparEnv
2059
2059
@@ -2381,7 +2381,7 @@ module TyconConstraintInference =
2381
2381
//-------------------------------------------------------------------------
2382
2382
2383
2383
let ComputeModuleName ( longPath : Ident list ) =
2384
- if longPath.Length <> 1 then error ( Error( FSComp.SR.tcInvalidModuleName(), ( List.head longPath) .idRange))
2384
+ if longPath.Length <> 1 then errorR ( Error( FSComp.SR.tcInvalidModuleName(), ( List.head longPath) .idRange))
2385
2385
longPath.Head
2386
2386
2387
2387
let CheckForDuplicateConcreteType env nm m =
@@ -2418,7 +2418,12 @@ module TcExceptionDeclarations =
2418
2418
2419
2419
let TcExnDefnCore_Phase1G_EstablishRepresentation ( cenv : cenv ) ( env : TcEnv ) parent ( exnc : Entity ) ( SynExceptionDefnRepr ( _ , SynUnionCase ( caseType = args), reprIdOpt, _, _, m)) =
2420
2420
let g = cenv.g
2421
- let args = match args with SynUnionCaseKind.Fields args -> args | _ -> error( Error( FSComp.SR.tcExplicitTypeSpecificationCannotBeUsedForExceptionConstructors(), m))
2421
+ let args =
2422
+ match args with
2423
+ | SynUnionCaseKind.Fields args -> args
2424
+ | _ ->
2425
+ errorR( Error( FSComp.SR.tcExplicitTypeSpecificationCannotBeUsedForExceptionConstructors(), m))
2426
+ []
2422
2427
let ad = env.AccessRights
2423
2428
let id = exnc.Id
2424
2429
@@ -2450,7 +2455,7 @@ module TcExceptionDeclarations =
2450
2455
// REVIEW: check this really is an exception type
2451
2456
match args' with
2452
2457
| [] -> ()
2453
- | _ -> error ( Error( FSComp.SR.tcAbbreviationsFordotNetExceptionsCannotTakeArguments(), m))
2458
+ | _ -> errorR ( Error( FSComp.SR.tcAbbreviationsFordotNetExceptionsCannotTakeArguments(), m))
2454
2459
let candidates =
2455
2460
meths |> List.filter ( fun minfo ->
2456
2461
minfo.NumArgs = [ args'.Length] &&
@@ -2545,7 +2550,7 @@ module EstablishTypeDefinitionCores =
2545
2550
2546
2551
/// Compute the mangled name of a type definition. 'doErase' is true for all type definitions except type abbreviations.
2547
2552
let private ComputeTyconName ( longPath : Ident list , doErase : bool , typars : Typars ) =
2548
- if longPath.Length <> 1 then error ( Error( FSComp.SR.tcInvalidTypeExtension(), longPath.Head.idRange))
2553
+ if longPath.Length <> 1 then errorR ( Error( FSComp.SR.tcInvalidTypeExtension(), longPath.Head.idRange))
2549
2554
let id = longPath.Head
2550
2555
let erasedArity =
2551
2556
if doErase then typars |> Seq.sumBy ( fun tp -> if tp.IsErased then 0 else 1 )
@@ -2569,7 +2574,7 @@ module EstablishTypeDefinitionCores =
2569
2574
let bi b = ( if b then 1 else 0 )
2570
2575
if ( bi hasClassAttr + bi hasInterfaceAttr + bi hasStructAttr + bi hasMeasureAttr) > 1 ||
2571
2576
( bi hasAbstractClassAttr + bi hasInterfaceAttr + bi hasStructAttr + bi hasMeasureAttr) > 1 then
2572
- error ( Error( FSComp.SR.tcAttributesOfTypeSpecifyMultipleKindsForType(), m))
2577
+ errorR ( Error( FSComp.SR.tcAttributesOfTypeSpecifyMultipleKindsForType(), m))
2573
2578
2574
2579
match kind with
2575
2580
| SynTypeDefnKind.Unspecified ->
@@ -2584,7 +2589,7 @@ module EstablishTypeDefinitionCores =
2584
2589
hasMeasureAttr && not ( match k with SynTypeDefnKind.Class | SynTypeDefnKind.Abbrev | SynTypeDefnKind.Opaque -> true | _ -> false ) ||
2585
2590
hasInterfaceAttr && not ( match k with SynTypeDefnKind.Interface -> true | _ -> false ) ||
2586
2591
hasStructAttr && not ( match k with SynTypeDefnKind.Struct | SynTypeDefnKind.Record | SynTypeDefnKind.Union -> true | _ -> false ) then
2587
- error ( Error( FSComp.SR.tcKindOfTypeSpecifiedDoesNotMatchDefinition(), m))
2592
+ errorR ( Error( FSComp.SR.tcKindOfTypeSpecifiedDoesNotMatchDefinition(), m))
2588
2593
k
2589
2594
2590
2595
[<return : Struct>]
@@ -2889,7 +2894,7 @@ module EstablishTypeDefinitionCores =
2889
2894
2890
2895
if hasMeasureAttr then
2891
2896
tycon.SetTypeOrMeasureKind TyparKind.Measure
2892
- if not ( isNil typars) then error ( Error( FSComp.SR.tcMeasureDefinitionsCannotHaveTypeParameters(), m))
2897
+ if not ( isNil typars) then errorR ( Error( FSComp.SR.tcMeasureDefinitionsCannotHaveTypeParameters(), m))
2893
2898
2894
2899
let repr =
2895
2900
match synTyconRepr with
@@ -5150,9 +5155,9 @@ let CheckLetOrDoInNamespace binds m =
5150
5155
| [ SynBinding ( accessibility= None; kind=( SynBindingKind.StandaloneExpression | SynBindingKind.Do); isInline= false ; isMutable= false ; attributes=[]; returnInfo= None; expr=( SynExpr.Do ( expr= SynExpr.Const ( constant= SynConst.Unit)) | SynExpr.Const ( constant= SynConst.Unit))) ] ->
5151
5156
()
5152
5157
| [] ->
5153
- error ( Error( FSComp.SR.tcNamespaceCannotContainValues(), m))
5158
+ errorR ( Error( FSComp.SR.tcNamespaceCannotContainValues(), m))
5154
5159
| _ ->
5155
- error ( Error( FSComp.SR.tcNamespaceCannotContainValues(), binds.Head.RangeOfHeadPattern))
5160
+ errorR ( Error( FSComp.SR.tcNamespaceCannotContainValues(), binds.Head.RangeOfHeadPattern))
5156
5161
5157
5162
let rec TcMutRecDefsFinish cenv defs m =
5158
5163
let opens =
0 commit comments