Skip to content

Commit 31710a2

Browse files
committed
Remove or $, fix tests
1 parent 5f508ea commit 31710a2

File tree

33 files changed

+70
-334
lines changed

33 files changed

+70
-334
lines changed

src/Compiler/Checking/Expressions/CheckExpressions.fs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,14 +3789,12 @@ let buildApp (cenv: cenv) expr resultTy arg m =
37893789

37903790
// Special rule for building applications of the 'x && y' operator
37913791
| ApplicableExpr(expr=Expr.App (Expr.Val (vref, _, _), _, _, [x0], _)), _
3792-
when valRefEq g vref g.and_vref
3793-
|| valRefEq g vref g.and2_vref ->
3792+
when valRefEq g vref g.and2_vref ->
37943793
MakeApplicableExprNoFlex cenv (mkLazyAnd g m x0 arg), resultTy
37953794

37963795
// Special rule for building applications of the 'x || y' operator
37973796
| ApplicableExpr(expr=Expr.App (Expr.Val (vref, _, _), _, _, [x0], _)), _
3798-
when valRefEq g vref g.or_vref
3799-
|| valRefEq g vref g.or2_vref ->
3797+
when valRefEq g vref g.or2_vref ->
38003798
MakeApplicableExprNoFlex cenv (mkLazyOr g m x0 arg ), resultTy
38013799

38023800
// Special rule for building applications of the 'reraise' operator
@@ -8608,9 +8606,7 @@ and TcApplicationThen (cenv: cenv) (overallTy: OverallTy) env tpenv mExprAndArg
86088606
match leftExpr with
86098607
| ApplicableExpr(expr=Expr.Val (vref, _, _))
86108608
| ApplicableExpr(expr=Expr.App (Expr.Val (vref, _, _), _, _, [_], _))
8611-
when valRefEq g vref g.and_vref
8612-
|| valRefEq g vref g.and2_vref
8613-
|| valRefEq g vref g.or_vref
8609+
when valRefEq g vref g.and2_vref
86148610
|| valRefEq g vref g.or2_vref -> { env with eIsControlFlow = true }
86158611
| _ -> env
86168612

src/Compiler/FSComp.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ csOverloadCandidateIndexedArgumentTypeMismatch,"Argument at index %d doesn't mat
391391
516,parsEofInComment,"End of file in comment begun at or before here"
392392
517,parsEofInStringInComment,"End of file in string embedded in comment begun at or before here"
393393
518,parsEofInVerbatimStringInComment,"End of file in verbatim string embedded in comment begun at or before here"
394-
519,parsEofInIfOcaml,"End of file in IF-OCAML section begun at or before here"
395394
520,parsEofInDirective,"End of file in directive begun at or before here"
396395
521,parsNoHashEndIfFound,"No #endif found for #if or #else"
397396
522,parsAttributesIgnored,"Attributes have been ignored in this construct"
@@ -1445,7 +1444,7 @@ keywordDescriptionNot,"Not actually a keyword. However, not struct in combinatio
14451444
keywordDescriptionNull,"Indicates the absence of an object. Also used in generic parameter constraints."
14461445
keywordDescriptionOf,"Used in discriminated unions to indicate the type of categories of values, and in delegate and exception declarations."
14471446
keywordDescriptionOpen,"Used to make the contents of a namespace or module available without qualification."
1448-
keywordDescriptionOr,"Used with Boolean conditions as a Boolean or operator. Equivalent to ||. Also used in member constraints."
1447+
keywordDescriptionOr,"Used in member constraints."
14491448
keywordDescriptionOverride,"Used to implement a version of an abstract or virtual method that differs from the base version."
14501449
keywordDescriptionPrivate,"Restricts access to a member to code in the same type or module."
14511450
keywordDescriptionPublic,"Allows access to a member from outside the type."

src/Compiler/Service/ServiceLexing.fs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ type FSharpTokenizerColorState =
466466
| Comment = 5
467467
| StringInComment = 6
468468
| VerbatimStringInComment = 7
469-
| CamlOnly = 8
470469
| VerbatimString = 9
471470
| SingleLineComment = 10
472471
| EndLineThenSkip = 11
@@ -719,8 +718,6 @@ module internal LexerStateEncoding =
719718
| LexerStringStyle.ExtendedInterpolated -> FSharpTokenizerColorState.TripleQuoteStringInComment
720719

721720
encodeLexCont (state, int64 n, m.Start, ifdefs, LexerStringKind.String, stringNest, 0)
722-
| LexCont.MLOnly(ifdefs, stringNest, m) ->
723-
encodeLexCont (FSharpTokenizerColorState.CamlOnly, 0L, m.Start, ifdefs, LexerStringKind.String, stringNest, 0)
724721

725722
let decodeLexInt (state: FSharpTokenizerLexState) =
726723
let tag, n1, p1, ifdefs, stringKind, stringNest, delimLen = decodeLexCont state
@@ -738,7 +735,6 @@ module internal LexerStateEncoding =
738735
LexCont.StringInComment(ifdefs, stringNest, LexerStringStyle.Verbatim, n1, mkRange "file" p1 p1)
739736
| FSharpTokenizerColorState.TripleQuoteStringInComment ->
740737
LexCont.StringInComment(ifdefs, stringNest, LexerStringStyle.TripleQuote, n1, mkRange "file" p1 p1)
741-
| FSharpTokenizerColorState.CamlOnly -> LexCont.MLOnly(ifdefs, stringNest, mkRange "file" p1 p1)
742738
| FSharpTokenizerColorState.VerbatimString ->
743739
LexCont.String(ifdefs, stringNest, LexerStringStyle.Verbatim, stringKind, delimLen, mkRange "file" p1 p1)
744740
| FSharpTokenizerColorState.TripleQuoteString ->
@@ -919,11 +915,6 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, maxLength: int option, fi
919915
| LexerStringStyle.TripleQuote
920916
| LexerStringStyle.ExtendedInterpolated -> Lexer.tripleQuoteStringInComment n m lexargs skip lexbuf
921917

922-
| LexCont.MLOnly(ifdefs, stringNest, m) ->
923-
lexargs.ifdefStack <- ifdefs
924-
lexargs.stringNest <- stringNest
925-
Lexer.mlOnly m lexargs skip lexbuf
926-
927918
let columnsOfCurrentToken () =
928919
let leftp = lexbuf.StartPos
929920
let rightp = lexbuf.EndPos

src/Compiler/Service/ServiceLexing.fsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type FSharpTokenizerColorState =
2727
| Comment = 5
2828
| StringInComment = 6
2929
| VerbatimStringInComment = 7
30-
| CamlOnly = 8
3130
| VerbatimString = 9
3231
| SingleLineComment = 10
3332
| EndLineThenSkip = 11

src/Compiler/Service/SynExpr.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ module SynExpr =
257257

258258
match trimmed[0], originalNotation with
259259
| _, ":=" -> ValueSome ColonEquals
260-
| _, ("||" | "or") -> ValueSome(BarBar(OriginalNotation originalNotation))
261-
| _, ("&" | "&&") -> ValueSome(AmpAmp(OriginalNotation originalNotation))
260+
| _, "||" -> ValueSome(BarBar(OriginalNotation originalNotation))
261+
| _, "&&" -> ValueSome(AmpAmp(OriginalNotation originalNotation))
262262
| '|', _
263263
| '&', _
264264
| '<', _

src/Compiler/SyntaxTree/ParseHelpers.fs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ type LexerContinuation =
166166
style: LexerStringStyle *
167167
int *
168168
range: range
169-
| MLOnly of ifdef: LexerIfdefStackEntries * nesting: LexerInterpolatedStringNesting * range: range
170169
| EndLine of ifdef: LexerIfdefStackEntries * nesting: LexerInterpolatedStringNesting * LexerEndlineContinuation
171170

172171
static member Default = LexCont.Token([], [])
@@ -179,8 +178,7 @@ type LexerContinuation =
179178
| LexCont.Comment(ifdef = ifd)
180179
| LexCont.SingleLineComment(ifdef = ifd)
181180
| LexCont.StringInComment(ifdef = ifd)
182-
| LexCont.EndLine(ifdef = ifd)
183-
| LexCont.MLOnly(ifdef = ifd) -> ifd
181+
| LexCont.EndLine(ifdef = ifd) -> ifd
184182

185183
member x.LexerInterpStringNesting =
186184
match x with
@@ -190,8 +188,7 @@ type LexerContinuation =
190188
| LexCont.Comment(nesting = nesting)
191189
| LexCont.SingleLineComment(nesting = nesting)
192190
| LexCont.StringInComment(nesting = nesting)
193-
| LexCont.EndLine(nesting = nesting)
194-
| LexCont.MLOnly(nesting = nesting) -> nesting
191+
| LexCont.EndLine(nesting = nesting) -> nesting
195192

196193
and LexCont = LexerContinuation
197194

@@ -807,8 +804,6 @@ let checkEndOfFileError t =
807804
| LexCont.StringInComment(_, _, LexerStringStyle.TripleQuote, _, m) ->
808805
reportParseErrorAt m (FSComp.SR.parsEofInTripleQuoteStringInComment ())
809806

810-
| LexCont.MLOnly(_, _, m) -> reportParseErrorAt m (FSComp.SR.parsEofInIfOcaml ())
811-
812807
| LexCont.EndLine(_, _, LexerEndlineContinuation.IfdefSkip(_, m)) -> reportParseErrorAt m (FSComp.SR.parsEofInDirective ())
813808

814809
| LexCont.EndLine(endifs, nesting, LexerEndlineContinuation.Token)

src/Compiler/SyntaxTree/ParseHelpers.fsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ type LexerContinuation =
9292
style: LexerStringStyle *
9393
int *
9494
range: range
95-
| MLOnly of ifdef: LexerIfdefStackEntries * nesting: LexerInterpolatedStringNesting * range: range
9695
| EndLine of ifdef: LexerIfdefStackEntries * nesting: LexerInterpolatedStringNesting * LexerEndlineContinuation
9796

9897
member LexerIfdefStack: LexerIfdefStackEntries

src/Compiler/SyntaxTree/PrettyNaming.fs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,27 +255,14 @@ let keywordsWithDescription: (string * string) list =
255255

256256
let keywordLookup = set (List.map fst keywordsWithDescription)
257257

258-
// Some legacy compat operator names are not encode using op_XYZ and this
259-
// do not carry sufficient information to distinguish between
260-
// let (or) x y = x || y
261-
// let ``or`` x y = x || y
262-
// let (land) x y = x || y
263-
// let ``land`` x y = x || y
264-
// All are deprecated except 'mod'. All except those two get double-backticks
265258
let IsUnencodedOpName (name: string) =
266259
match name with
267260
| "mod" -> true
268261
| _ -> false
269262

270-
let IsUnencodedLegacyOpName (name: string) =
271-
match name with
272-
| "or" -> true
273-
| _ -> false
274-
275263
let IsIdentifierName (name: string) =
276264
not (keywordLookup.Contains name)
277265
&& not (IsUnencodedOpName name)
278-
&& not (IsUnencodedLegacyOpName name)
279266
&& let nameLen = name.Length in
280267

281268
nameLen > 0
@@ -423,7 +410,7 @@ let CompileOpName op =
423410
match standardOpNames.TryGetValue op with
424411
| true, x -> x
425412
| false, _ ->
426-
if IsUnencodedOpName op || IsUnencodedLegacyOpName op || IsIdentifierName op then
413+
if IsUnencodedOpName op || IsIdentifierName op then
427414
op
428415
else
429416
compileCustomOpName op
@@ -771,8 +758,6 @@ let IsLogicalOpName (logicalName: string) =
771758

772759
let (|Control|Equality|Relational|Indexer|FixedTypes|Other|) opName =
773760
match opName with
774-
| "&"
775-
| "or"
776761
| "&&"
777762
| "||" -> Control
778763
| "<>"

src/Compiler/TypedTree/TcGlobals.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,9 @@ type TcGlobals(
688688
let v_memoize_file =
689689
MemoizationTable<int, ILSourceDocument>("v_memoize_file", compute, keyComparer = HashIdentity.Structural)
690690

691-
let v_and_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, CompileOpName "&" , None , None , [], mk_rel_sig v_bool_ty)
692691
let v_addrof_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, CompileOpName "~&" , None , None , [vara], ([[varaTy]], mkByrefTy varaTy))
693692
let v_addrof2_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, CompileOpName "~&&" , None , None , [vara], ([[varaTy]], mkNativePtrTy varaTy))
694693
let v_and2_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, CompileOpName "&&" , None , None , [], mk_rel_sig v_bool_ty)
695-
let v_or_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, "or" , None , Some "Or" , [], mk_rel_sig v_bool_ty)
696694
let v_or2_info = makeIntrinsicValRef(fslib_MFIntrinsicOperators_nleref, CompileOpName "||" , None , None , [], mk_rel_sig v_bool_ty)
697695
let v_compare_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "compare" , None , Some "Compare", [vara], mk_compare_sig varaTy)
698696
let v_equals_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, CompileOpName "=" , None , None , [vara], mk_rel_sig varaTy)
@@ -1574,11 +1572,9 @@ type TcGlobals(
15741572
member _.new_decimal_info = v_new_decimal_info
15751573
member _.seq_info = v_seq_info
15761574
member val seq_vref = (ValRefForIntrinsic v_seq_info)
1577-
member val and_vref = (ValRefForIntrinsic v_and_info)
15781575
member val and2_vref = (ValRefForIntrinsic v_and2_info)
15791576
member val addrof_vref = (ValRefForIntrinsic v_addrof_info)
15801577
member val addrof2_vref = (ValRefForIntrinsic v_addrof2_info)
1581-
member val or_vref = (ValRefForIntrinsic v_or_info)
15821578
member val splice_expr_vref = (ValRefForIntrinsic v_splice_expr_info)
15831579
member val splice_raw_expr_vref = (ValRefForIntrinsic v_splice_raw_expr_info)
15841580
member val or2_vref = (ValRefForIntrinsic v_or2_info)

src/Compiler/TypedTree/TcGlobals.fsi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ type internal TcGlobals =
278278

279279
member and2_vref: TypedTree.ValRef
280280

281-
member and_vref: TypedTree.ValRef
282-
283281
member array2D_get_info: IntrinsicValRef
284282

285283
member array2D_get_vref: TypedTree.ValRef
@@ -931,8 +929,6 @@ type internal TcGlobals =
931929

932930
member or2_vref: TypedTree.ValRef
933931

934-
member or_vref: TypedTree.ValRef
935-
936932
member outref_tcr: TypedTree.EntityRef
937933

938934
member pathMap: Internal.Utilities.PathMap

0 commit comments

Comments
 (0)