Skip to content

Commit

Permalink
add explanation text
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Syme committed Aug 31, 2021
1 parent 379b15f commit 884d8c5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/fsharp/ErrorLogger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ let deprecatedOperator m = deprecatedWithError (FSComp.SR.elDeprecatedOperator()

let mlCompatWarning s m = warning(UserCompilerMessage(FSComp.SR.mlCompatMessage s, 62, m))

let mlCompatError m = errorR(UserCompilerMessage(FSComp.SR.mlCompatError(), 62, m))
let mlCompatError s m = errorR(UserCompilerMessage(FSComp.SR.mlCompatError s, 62, m))

let suppressErrorReporting f =
let errorLogger = CompileThreadStatic.ErrorLogger
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/ErrorLogger.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ val deprecatedOperator: m:range -> unit

val mlCompatWarning: s:string -> m:range -> unit

val mlCompatError: m:range -> unit
val mlCompatError: s:string -> m:range -> unit

val suppressErrorReporting: f:(unit -> 'a) -> 'a

Expand Down
7 changes: 6 additions & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,13 @@ parsNonAtomicType,"The use of the type syntax 'int C' and 'C <int>' is not perm
#1203 - used for error in FSharp.Core CompilerMessage message
#1204 - used for error in FSharp.Core CompilerMessage message
mlCompatMessage,"This construct is for ML compatibility. %s. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'."
mlCompatError,"This construct is deprecated. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'."
mlCompatError,"This construct is deprecated. %s. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'."
mlCompatKeyword,"In previous versions of F# '%s' was a reserved keyword but the use of this keyword is now deprecated"
mlCompatLightOffNoLongerSupported,"The use of '#light \"off\"' or '#indent \"off\"' is no longer supported"
mlCompatMultiPrefixTyparsNoLongerSupported,"The use of '#light \"off\"' or '#indent \"off\"' was deprecated in F# 2.0 and is no longer supported"
mlCompatSigColonNoLongerSupported,"The use of 'module M: sig ... end ' was deprecated in F# 2.0 and is no longer supported. Change the ':' to an '=' and remove the 'sig' and 'end' and use indentation instead"
mlCompatMultiPrefixTyparsNoLongerSupported,"The use of multiple parenthesized type parameters before a generic type name such as '(int, int) Map' was deprecated in F# 2.0 and is no longer supported"
mlCompatStructEndNoLongerSupported,"The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead"
#1205,chkDuplicateInherittedVirtualMethod,"Duplicate virtual methods. There are multiple virtual methods named '%s' with the same signature in the parent (inherited) type. This may be a result of instantiating the parent type."
1206,ilFieldDoesNotHaveValidOffsetForStructureLayout,"The type '%s' has been marked as having an Explicit layout, but the field '%s' has not been marked with the 'FieldOffset' attribute"
1207,tcInterfacesShouldUseInheritNotInterface,"Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'"
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/lex.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ rule token args skip = parse
| ("#indent" | "#light") anywhite+ "\"off\""
{ args.lightStatus.Status <- false
if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError lexbuf.LexemeRange
mlCompatError (FSComp.SR.mlCompatLightOffNoLongerSupported()) lexbuf.LexemeRange
else
mlCompatWarning (FSComp.SR.lexIndentOffForML()) lexbuf.LexemeRange
if not skip then HASH_LIGHT (LexCont.Token (args.ifdefStack, args.stringNest))
Expand Down
12 changes: 6 additions & 6 deletions src/fsharp/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -4276,7 +4276,7 @@ atomicExprQualification:
mkSynDot dotm lhsm e (ident(CompileOpName "*", opm))
| _ ->
if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (lhs parseState)
mlCompatError (FSComp.SR.mlCompatMultiPrefixTyparsNoLongerSupported()) (lhs parseState)
else
mlCompatWarning (FSComp.SR.parsParenFormIsForML()) (lhs parseState)
mkSynDotParenGet lhsm dotm e $2) }
Expand Down Expand Up @@ -5001,7 +5001,7 @@ appType:
| LPAREN appTypePrefixArguments rparen appTypeConPower
{ let args, commas = $2
if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (unionRanges (rhs parseState 1) $4.Range)
mlCompatError (FSComp.SR.mlCompatMultiPrefixTyparsNoLongerSupported()) (unionRanges (rhs parseState 1) $4.Range)
else
mlCompatWarning (FSComp.SR.parsMultiArgumentGenericTypeFormDeprecated()) (unionRanges (rhs parseState 1) $4.Range)
SynType.App($4, None, args, commas, None, true, unionRanges (rhs parseState 1) $4.Range) }
Expand Down Expand Up @@ -5063,7 +5063,7 @@ atomTypeNonAtomicDeprecated:
| LPAREN appTypePrefixArguments rparen appTypeConPower
{ let args, commas = $2
if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (unionRanges (rhs parseState 1) $4.Range)
mlCompatError (FSComp.SR.mlCompatMultiPrefixTyparsNoLongerSupported()) (unionRanges (rhs parseState 1) $4.Range)
else
mlCompatWarning (FSComp.SR.parsMultiArgumentGenericTypeFormDeprecated()) (unionRanges (rhs parseState 1) $4.Range)
SynType.App($4, None, args, commas, None, true, unionRanges (rhs parseState 1) $4.Range) }
Expand Down Expand Up @@ -5571,7 +5571,7 @@ doneDeclEnd:
structOrBegin:
| STRUCT
{ if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (lhs parseState)
mlCompatError (FSComp.SR.mlCompatStructEndNoLongerSupported()) (lhs parseState)
else
mlCompatWarning (FSComp.SR.parsSyntaxModuleStructEndDeprecated()) (lhs parseState)
}
Expand All @@ -5580,7 +5580,7 @@ structOrBegin:
sigOrBegin:
| SIG
{ if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (lhs parseState)
mlCompatError (FSComp.SR.mlCompatSigEndNoLongerSupported())(lhs parseState)
else
mlCompatWarning (FSComp.SR.parsSyntaxModuleSigEndDeprecated()) (lhs parseState)
}
Expand All @@ -5589,7 +5589,7 @@ sigOrBegin:
colonOrEquals:
| COLON
{ if parseState.LexBuffer.SupportsFeature LanguageFeature.MLCompatRevisions then
mlCompatError (lhs parseState)
mlCompatError (FSComp.SR.mlCompatSigColonNoLongerSupported())(lhs parseState)
else
mlCompatWarning (FSComp.SR.parsSyntaxModuleSigEndDeprecated()) (lhs parseState)
}
Expand Down

0 comments on commit 884d8c5

Please sign in to comment.