diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md index b4df947561a..7765e472f93 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -22,3 +22,4 @@ * Simplify creation of `FSharpDiagnostics`. In a few cases, errors without ranges were assigned to the currently checked file, while in other cases they carried an empty range. The latter is now true in all cases. In a few cases, ranges at eof were corrected, while in others they were not. They are now always left uncorrected. This is a prerequisit for [#18553](https://github.com/dotnet/fsharp/issues/18553). ([PR #18610](https://github.com/dotnet/fsharp/pull/18610)). * `SynExprRecordField` now includes a `range` field ([PR #18617](https://github.com/dotnet/fsharp/pull/18617)) * Mark `Range.Zero` as obsolete in favor of `Range.range0` ([PR #18664](https://github.com/dotnet/fsharp/pull/18664)) +* Redesign #line processing. The original positions (unaffected by #line directives) are now kept in the AST, and `__LINE__` and `__SOURCE_LINE__` show the original line numbers / file names. However, all diagnostics and debug information stays the same (shows the position transformed by the #line directives). ([Issue #18553](https://github.com/dotnet/fsharp/issues/18553), [PR #18699](https://github.com/dotnet/fsharp/pull/18699)) diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index 3b42f561c1a..ea466faa5fe 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -1069,11 +1069,12 @@ let CompilePatternBasic mkCompGenSequential mMatch e (mkDefault (mMatch, resultTy)) | ThrowIncompleteMatchException -> + let mmMatch = mMatch.ApplyLineDirectives() mkThrow mMatch resultTy (mkExnExpr(g.MatchFailureException_tcr, - [ mkString g mMatch mMatch.FileName - mkInt g mMatch mMatch.StartLine - mkInt g mMatch mMatch.StartColumn], mMatch)) + [ mkString g mMatch mmMatch.FileName + mkInt g mMatch mmMatch.StartLine + mkInt g mMatch mmMatch.StartColumn], mMatch)) | IgnoreWithWarning -> mkUnit g mMatch diff --git a/src/Compiler/Checking/QuotationTranslator.fs b/src/Compiler/Checking/QuotationTranslator.fs index d5daa377540..cfe98e4ac7d 100644 --- a/src/Compiler/Checking/QuotationTranslator.fs +++ b/src/Compiler/Checking/QuotationTranslator.fs @@ -214,7 +214,7 @@ let (|ObjectInitializationCheck|_|) g expr = isUnitTy g resultTy -> ValueSome() | _ -> ValueNone -let rec EmitDebugInfoIfNecessary cenv env m astExpr : ExprData = +let rec EmitDebugInfoIfNecessary cenv env (m: range) astExpr : ExprData = // do not emit debug info if emitDebugInfoInQuotations = false or it was already written for the given expression if cenv.emitDebugInfoInQuotations && not (QP.isAttributedExpression astExpr) then cenv.emitDebugInfoInQuotations <- false @@ -222,12 +222,13 @@ let rec EmitDebugInfoIfNecessary cenv env m astExpr : ExprData = let mk_tuple g m es = mkRefTupled g m es (List.map (tyOfExpr g) es) let rangeExpr = + let mm = m.ApplyLineDirectives() // LineDirectives: map ranges for the debugger mk_tuple cenv.g m - [ mkString cenv.g m m.FileName - mkInt cenv.g m m.StartLine - mkInt cenv.g m m.StartColumn - mkInt cenv.g m m.EndLine - mkInt cenv.g m m.EndColumn ] + [ mkString cenv.g m mm.FileName + mkInt cenv.g m mm.StartLine + mkInt cenv.g m mm.StartColumn + mkInt cenv.g m mm.EndLine + mkInt cenv.g m mm.EndColumn ] let attrExpr = mk_tuple cenv.g m [ mkString cenv.g m "DebugRange" diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 258346b9104..08020ebf21b 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -1849,6 +1849,8 @@ let AddIncrementalLocalAssemblyFragmentToIlxGenEnv (cenv: cenv, isIncrementalFra /// Generate IL debugging information. let GenILSourceMarker (g: TcGlobals) (m: range) = + let m = m.ApplyLineDirectives() + ILDebugPoint.Create( document = g.memoize_file m.FileIndex, line = m.StartLine, @@ -2512,7 +2514,7 @@ type CodeGenBuffer(m: range, mgbuf: AssemblyBuilder, methodName, alreadyUsedArgs // Add a nop to make way for the first debug point. do if mgbuf.cenv.options.generateDebugSymbols then - let doc = g.memoize_file m.FileIndex + let doc = g.memoize_file (m.ApplyLineDirectives().FileIndex) let i = FeeFeeInstr mgbuf.cenv doc codebuf.Add i // for the FeeFee or a better debug point @@ -2599,7 +2601,7 @@ type CodeGenBuffer(m: range, mgbuf: AssemblyBuilder, methodName, alreadyUsedArgs // Emit FeeFee breakpoints for hidden code, see https://blogs.msdn.microsoft.com/jmstall/2005/06/19/line-hidden-and-0xfeefee-sequence-points/ member cgbuf.EmitStartOfHiddenCode() = if mgbuf.cenv.options.generateDebugSymbols then - let doc = g.memoize_file m.FileIndex + let doc = g.memoize_file (m.ApplyLineDirectives().FileIndex) let i = FeeFeeInstr mgbuf.cenv doc hasDebugPoints <- true diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 1845c2e00a6..f649beacc4a 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -2050,6 +2050,7 @@ let FormatDiagnosticLocation (tcConfig: TcConfig) (m: Range) : FormattedDiagnost File = "" } else + let m = m.ApplyLineDirectives() let file = m.FileName let file = @@ -2181,6 +2182,8 @@ let CollectFormattedDiagnostics (tcConfig: TcConfig, severity: FSharpDiagnosticS | DiagnosticStyle.Rich -> match diagnostic.Range with | Some m -> + let m = m.ApplyLineDirectives() + let content = m.FileName |> FileSystem.GetFullFilePathInDirectoryShim tcConfig.implicitIncludeDir @@ -2266,6 +2269,7 @@ type PhasedDiagnostic with match diagnostic.Range with | None -> () | Some m -> + let m = m.ApplyLineDirectives() let fileName = m.FileName let lineA = m.StartLine let lineB = m.EndLine diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 1eb950fd990..fd6eabbf0f9 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -215,24 +215,24 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, fileName, intf) SynModuleOrNamespaceSig(lid, isRecursive, kind, decls, xmlDoc, attributes, None, range, trivia) -let private collectCodeComments (lexbuf: UnicodeLexing.Lexbuf) = - let tripleSlashComments = XmlDocStore.ReportInvalidXmlDocPositions(lexbuf) - - [ - yield! CommentStore.GetComments(lexbuf) - yield! (List.map CommentTrivia.LineComment tripleSlashComments) - ] - |> List.sortBy (function - | CommentTrivia.LineComment r - | CommentTrivia.BlockComment r -> r.StartLine, r.StartColumn) - -let private collectParsedInputTrivia lexbuf diagnosticOptions isScript submoduleRanges = +let private finishPreprocessing lexbuf diagnosticOptions isScript submoduleRanges = WarnScopes.MergeInto diagnosticOptions isScript submoduleRanges lexbuf + LineDirectives.add lexbuf.StartPos.FileIndex (LineDirectiveStore.GetLineDirectives lexbuf) +let private collectParsedInputTrivia lexbuf = { ConditionalDirectives = IfdefStore.GetTrivia(lexbuf) WarnDirectives = WarnScopes.getDirectiveTrivia (lexbuf) - CodeComments = collectCodeComments lexbuf + CodeComments = + let tripleSlashComments = XmlDocStore.ReportInvalidXmlDocPositions(lexbuf) + + [ + yield! CommentStore.GetComments(lexbuf) + yield! List.map CommentTrivia.LineComment tripleSlashComments + ] + |> List.sortBy (function + | CommentTrivia.LineComment r + | CommentTrivia.BlockComment r -> r.StartLine, r.StartColumn) } let private getImplSubmoduleRanges (impls: ParsedImplFileFragment list) = @@ -276,8 +276,9 @@ let PostParseModuleImpls let isScript = IsScript fileName - let trivia = - collectParsedInputTrivia lexbuf diagnosticOptions isScript (getImplSubmoduleRanges impls) + finishPreprocessing lexbuf diagnosticOptions isScript (getImplSubmoduleRanges impls) + + let trivia = collectParsedInputTrivia lexbuf let othersWithSameName = impls @@ -309,8 +310,9 @@ let PostParseModuleSpecs identifiers: Set ) = - let trivia = - collectParsedInputTrivia lexbuf diagnosticOptions false (getSpecSubmoduleRanges specs) + finishPreprocessing lexbuf diagnosticOptions false (getSpecSubmoduleRanges specs) + + let trivia = collectParsedInputTrivia lexbuf let othersWithSameName = specs diff --git a/src/Compiler/Facilities/prim-lexing.fs b/src/Compiler/Facilities/prim-lexing.fs index 381e11eaa3a..72c4fa22f58 100644 --- a/src/Compiler/Facilities/prim-lexing.fs +++ b/src/Compiler/Facilities/prim-lexing.fs @@ -211,40 +211,35 @@ open System.Collections.Generic type internal Position = val FileIndex: int val Line: int - val OriginalLine: int val AbsoluteOffset: int val StartOfLineAbsoluteOffset: int member x.Column = x.AbsoluteOffset - x.StartOfLineAbsoluteOffset - new(fileIndex: int, line: int, originalLine: int, startOfLineAbsoluteOffset: int, absoluteOffset: int) = + new(fileIndex: int, line: int, startOfLineAbsoluteOffset: int, absoluteOffset: int) = { FileIndex = fileIndex Line = line - OriginalLine = originalLine AbsoluteOffset = absoluteOffset StartOfLineAbsoluteOffset = startOfLineAbsoluteOffset } member x.NextLine = - Position(x.FileIndex, x.Line + 1, x.OriginalLine + 1, x.AbsoluteOffset, x.AbsoluteOffset) + Position(x.FileIndex, x.Line + 1, x.AbsoluteOffset, x.AbsoluteOffset) member x.EndOfToken n = - Position(x.FileIndex, x.Line, x.OriginalLine, x.StartOfLineAbsoluteOffset, x.AbsoluteOffset + n) + Position(x.FileIndex, x.Line, x.StartOfLineAbsoluteOffset, x.AbsoluteOffset + n) member x.ShiftColumnBy by = - Position(x.FileIndex, x.Line, x.OriginalLine, x.StartOfLineAbsoluteOffset, x.AbsoluteOffset + by) + Position(x.FileIndex, x.Line, x.StartOfLineAbsoluteOffset, x.AbsoluteOffset + by) member x.ColumnMinusOne = - Position(x.FileIndex, x.Line, x.OriginalLine, x.StartOfLineAbsoluteOffset, x.StartOfLineAbsoluteOffset - 1) - - member x.ApplyLineDirective(fileIdx, line) = - Position(fileIdx, line, x.OriginalLine + 1, x.AbsoluteOffset, x.AbsoluteOffset) + Position(x.FileIndex, x.Line, x.StartOfLineAbsoluteOffset, x.StartOfLineAbsoluteOffset - 1) override p.ToString() = $"({p.Line},{p.Column})" static member Empty = Position() - static member FirstLine fileIdx = Position(fileIdx, 1, 1, 0, 0) + static member FirstLine fileIdx = Position(fileIdx, 1, 0, 0) type internal LexBufferFiller<'Char> = LexBuffer<'Char> -> unit diff --git a/src/Compiler/Facilities/prim-lexing.fsi b/src/Compiler/Facilities/prim-lexing.fsi index ff13f96c9e1..c95a97a8d42 100644 --- a/src/Compiler/Facilities/prim-lexing.fsi +++ b/src/Compiler/Facilities/prim-lexing.fsi @@ -76,10 +76,6 @@ type internal Position = /// for the new line by modifying the EndPos property of the LexBuffer. val Line: int - /// The line number for the position in the input stream, assuming fresh positions have been updated - /// using for the new line. - val OriginalLine: int - /// The character number in the input stream. val AbsoluteOffset: int @@ -102,9 +98,6 @@ type internal Position = /// Same line, column -1. member ColumnMinusOne: Position - /// Apply a #line directive. - member ApplyLineDirective: fileIdx: int * line: int -> Position - /// Get an arbitrary position, with the empty string as file name. static member Empty: Position diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fs b/src/Compiler/Symbols/FSharpDiagnostic.fs index 4dcc6305630..131e49845c3 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fs +++ b/src/Compiler/Symbols/FSharpDiagnostic.fs @@ -235,7 +235,7 @@ type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: str | _ -> diagnostic.FormatCore(flatErrors, suggestNames) let errorNum = diagnostic.Number - let m = match diagnostic.Range with Some m -> m | None -> range0 + let m = match diagnostic.Range with Some m -> m.ApplyLineDirectives() | None -> range0 FSharpDiagnostic(m, severity, msg, diagnostic.Subcategory(), errorNum, "FS", extendedData) static member NewlineifyErrorString(message) = NewlineifyErrorString(message) @@ -335,10 +335,13 @@ module DiagnosticHelpers = | FSharpDiagnosticSeverity.Hidden -> [] | adjustedSeverity -> - let diagnostic = FSharpDiagnostic.CreateFromException (diagnostic, adjustedSeverity, suggestNames, flatErrors, symbolEnv) - let fileName = diagnostic.Range.FileName + let fileName = + match diagnostic.Range with + | Some r -> r.FileName + | None -> TcGlobals.DummyFileNameForRangesWithoutASpecificLocation + let fDiagnostic = FSharpDiagnostic.CreateFromException (diagnostic, adjustedSeverity, suggestNames, flatErrors, symbolEnv) if allErrors || fileName = mainInputFileName || fileName = TcGlobals.DummyFileNameForRangesWithoutASpecificLocation then - [diagnostic] + [fDiagnostic] else [] let CreateDiagnostics (options, allErrors, mainInputFileName, diagnostics, suggestNames, flatErrors, symbolEnv) = diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index e298202d984..1fb62e72940 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -19,9 +19,9 @@ open FSharp.Compiler.UnicodeLexing let forceDebug = false -let stringOfPos (pos: Position) = sprintf "(%d:%d)" pos.OriginalLine pos.Column +let stringOfPos (pos: Position) = sprintf "(%d:%d)" pos.Line pos.Column -let outputPos os (pos: Position) = Printf.fprintf os "(%d:%d)" pos.OriginalLine pos.Column +let outputPos os (pos: Position) = Printf.fprintf os "(%d:%d)" pos.Line pos.Column /// Used for warning strings, which should display columns as 1-based and display /// the lines after taking '# line' directives into account (i.e. do not use @@ -996,7 +996,7 @@ type LexFilterImpl ( let warnF = if strictIndentation then error else warn warnF tokenTup (if debug then - sprintf "possible incorrect indentation: this token is offside of context at position %s, newCtxt = %A, stack = %A, newCtxtPos = %s, c1 = %d, c2 = %d" + sprintf "possible incorrect indentation: this token is offside of context at (original!) position %s, newCtxt = %A, stack = %A, newCtxtPos = %s, c1 = %d, c2 = %d" (warningStringOfPosition p1.Position) newCtxt offsideStack (stringOfPos newCtxt.StartPos) p1.Column c2 else FSComp.SR.lexfltTokenIsOffsideOfContextStartedEarlier(warningStringOfPosition p1.Position)) @@ -1305,7 +1305,7 @@ type LexFilterImpl ( let isSameLine() = match token with | EOF _ -> false - | _ -> (startPosOfTokenTup (peekNextTokenTup())).OriginalLine = tokenStartPos.OriginalLine + | _ -> (startPosOfTokenTup (peekNextTokenTup())).Line = tokenStartPos.Line let isControlFlowOrNotSameLine() = match token with @@ -1817,7 +1817,7 @@ type LexFilterImpl ( elif isTypeCtxt then isTypeSeqBlockElementContinuator token else isSeqBlockElementContinuator token) && (tokenStartCol = offsidePos.Column) - && (tokenStartPos.OriginalLine <> offsidePos.OriginalLine) -> + && (tokenStartPos.Line <> offsidePos.Line) -> if debug then dprintf "offside at column %d matches start of block(%a)! delaying token, returning OBLOCKSEP\n" tokenStartCol outputPos offsidePos replaceCtxt tokenTup (CtxtSeqBlock (FirstInSeqBlock, offsidePos, addBlockEnd)) // No change to offside stack: another statement block starts... @@ -2320,7 +2320,7 @@ type LexFilterImpl ( // For attributes on properties: // member x.PublicGetSetProperty // with [] get() = "Ralf" - if (match lookaheadTokenTup.Token with LBRACK_LESS -> true | _ -> false) && (lookaheadTokenStartPos.OriginalLine = tokenTup.StartPos.OriginalLine) then + if (match lookaheadTokenTup.Token with LBRACK_LESS -> true | _ -> false) && (lookaheadTokenStartPos.Line = tokenTup.StartPos.Line) then let offsidePos = tokenStartPos pushCtxt tokenTup (CtxtWithAsLet offsidePos) returnToken tokenLexbufState OWITH diff --git a/src/Compiler/SyntaxTree/LexerStore.fs b/src/Compiler/SyntaxTree/LexerStore.fs index e2c6010a561..8daf2125fcd 100644 --- a/src/Compiler/SyntaxTree/LexerStore.fs +++ b/src/Compiler/SyntaxTree/LexerStore.fs @@ -143,3 +143,20 @@ module CommentStore = let GetComments (lexbuf: Lexbuf) : CommentTrivia list = let store = getStore lexbuf Seq.toList store + +//------------------------------------------------------------------------ +// Storage to hold the current accumulated line directives, and related access functions +//------------------------------------------------------------------------ + +[] +module LineDirectiveStore = + let private getStore (lexbuf: Lexbuf) = + lexbuf.GetLocalData("LineDirectives", ResizeArray) + + let SaveLineDirective (lexbuf: Lexbuf, fileIndex: FileIndex, line: int) = + let store = getStore lexbuf + store.Add(lexbuf.StartPos.Line, (fileIndex, line)) + + let GetLineDirectives (lexbuf: Lexbuf) : (int * (FileIndex * int)) list = + let store = getStore lexbuf + Seq.toList store diff --git a/src/Compiler/SyntaxTree/LexerStore.fsi b/src/Compiler/SyntaxTree/LexerStore.fsi index e6bda944438..c63174a770b 100644 --- a/src/Compiler/SyntaxTree/LexerStore.fsi +++ b/src/Compiler/SyntaxTree/LexerStore.fsi @@ -50,3 +50,10 @@ module CommentStore = val SaveBlockComment: lexbuf: Lexbuf * startRange: range * endRange: range -> unit val GetComments: lexbuf: Lexbuf -> CommentTrivia list + +[] +module LineDirectiveStore = + + val SaveLineDirective: lexbuf: Lexbuf * fileIndex: FileIndex * line: int -> unit + + val GetLineDirectives: lexbuf: Lexbuf -> (int * (FileIndex * int)) list diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 5e3542f6b69..2711750586f 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -775,10 +775,7 @@ type SynExpr = member e.Range = match e with - | SynExpr.Paren(_, leftParenRange, rightParenRange, r) -> - match rightParenRange with - | Some rightParenRange when leftParenRange.FileIndex <> rightParenRange.FileIndex -> leftParenRange - | _ -> r + | SynExpr.Paren(range = m) | SynExpr.Quote(range = m) | SynExpr.Const(range = m) | SynExpr.Typed(range = m) diff --git a/src/Compiler/SyntaxTree/WarnScopes.fs b/src/Compiler/SyntaxTree/WarnScopes.fs index cf5e8431d42..cd473055fcb 100644 --- a/src/Compiler/SyntaxTree/WarnScopes.fs +++ b/src/Compiler/SyntaxTree/WarnScopes.fs @@ -45,46 +45,21 @@ module internal WarnScopes = | [] -> false | h :: _ -> h.IsWarnon - type private LineDirective = - { - SurrogateFileIndex: FileIndex - SurrogateLine: LineNumber - OriginalLine: LineNumber - } - type private LexbufData = { - OriginalFileIndex: int + OriginalFileIndex: int // TODO: no longer needed mutable WarnDirectives: WarnDirective list - mutable LineDirectives: LineDirective list } let private initialData (lexbuf: Lexbuf) = { OriginalFileIndex = lexbuf.StartPos.FileIndex WarnDirectives = [] - LineDirectives = [] } let private getLexbufData (lexbuf: Lexbuf) = lexbuf.GetLocalData("WarnScopeData", (fun () -> initialData lexbuf)) - // ************************************* - // Collect the line directives during lexing - // ************************************* - - let RegisterLineDirective (lexbuf, fileIndex, line: int) = //TODO: send OriginalLine i.o. lexbuf - let data = getLexbufData lexbuf - - let lineDirective = - { - SurrogateFileIndex = fileIndex - SurrogateLine = line - OriginalLine = lexbuf.StartPos.OriginalLine + 1 - } - - data.LineDirectives <- lineDirective :: data.LineDirectives - // ************************************* // Collect the warn scopes during lexing // ************************************* @@ -142,7 +117,7 @@ module internal WarnScopes = Regex("""( *)#(\S+)(?: +([^ \r\n/;]+))*(?:;;)?( *)(\/\/.*)?$""", RegexOptions.CultureInvariant) - let private parseDirective originalFileIndex lexbuf = + let private parseDirective lexbuf = let text = Lexbuf.LexemeString lexbuf let startPos = lexbuf.StartPos @@ -153,14 +128,10 @@ module internal WarnScopes = let positions line offset length = mkPos line (startPos.Column + offset), mkPos line (startPos.Column + offset + length) - // "normal" ranges (i.e. taking #line directives into account), for errors in the warn directive + let mkRange offset length = positions lexbuf.StartPos.Line offset length ||> mkFileIndexRange startPos.FileIndex - // "original" ranges, for the warn scopes - let mkOriginalRange offset length = - positions lexbuf.StartPos.OriginalLine offset length - ||> mkFileIndexRange originalFileIndex let directiveRange = mkRange 0 totalLength @@ -168,8 +139,8 @@ module internal WarnScopes = errorR (Error(FSComp.SR.lexWarnDirectiveMustHaveArgs (), directiveRange)) let mkDirective ctor (c: Capture) = - getNumber lexbuf.LanguageVersion (mkRange c.Index c.Length) c.Value - |> Option.map (fun n -> ctor (n, mkOriginalRange c.Index c.Length)) + let m = mkRange c.Index c.Length + getNumber lexbuf.LanguageVersion m c.Value |> Option.map (fun n -> ctor (n, m)) let warnCmds = match dIdent with @@ -186,7 +157,7 @@ module internal WarnScopes = let ParseAndRegisterWarnDirective (lexbuf: Lexbuf) = let data = getLexbufData lexbuf - let warnDirective = parseDirective data.OriginalFileIndex lexbuf + let warnDirective = parseDirective lexbuf data.WarnDirectives <- warnDirective :: data.WarnDirectives // ************************************* @@ -200,18 +171,11 @@ module internal WarnScopes = | OpenOff of range | OpenOn of range - /// Information about the mapping implied by the #line directives. - /// The Map key is the file index of the surrogate source (the source file pointed to by the line directive). - /// The Map value contains the file index of the original source (the one just being parsed) and - /// a list of mapped sections (surrogate and original start lines). - type private LineMaps = Map - type private WarnScopeData = { ScopedNowarnFeatureIsSupported: bool ScriptNowarns: WarningNumber list // only needed to avoid breaking changes for previous language versions WarnScopes: Map> - LineMaps: LineMaps } let private getWarnScopeData (diagnosticOptions: FSharpDiagnosticOptions) = @@ -221,7 +185,6 @@ module internal WarnScopes = ScopedNowarnFeatureIsSupported = true ScriptNowarns = [] WarnScopes = Map.empty - LineMaps = Map.empty } | Some data -> data :?> WarnScopeData @@ -275,7 +238,8 @@ module internal WarnScopes = Map.tryFind warningNumber warnScopes |> Option.defaultValue [] let mkScope (m1: range) (m2: range) = - mkFileIndexRange m1.FileIndex m1.Start m2.End + assert (m1.FileIndex = m2.FileIndex) + mkFileIndexRange m1.FileIndex m1.Start m2.End // LineDirectives: n/a match warnCmd with | WarnCmd.Nowarn(n, m) -> @@ -299,47 +263,17 @@ module internal WarnScopes = let fileWarnScopes = fileWarnCmds |> List.fold processWarnCmd Map.empty - let fileLineMaps: LineMaps = - let sortedSectionMaps = - List.map (fun ld -> ld.SurrogateLine, ld.OriginalLine) >> List.sortBy fst - - lexbufData.LineDirectives - |> List.groupBy _.SurrogateFileIndex - |> List.map (fun (surrIdx, lineDirectives) -> surrIdx, (fileIndex, sortedSectionMaps lineDirectives)) - |> Map - let merge () = let projectData = getWarnScopeData diagnosticOptions // If the same file is parsed again (same fileIndex), we replace the warn scopes. let projectWarnScopes = projectData.WarnScopes.Add(fileIndex, fileWarnScopes) - // If the same surrogate file has entries already (from another parse), we replace the line maps. - // However, if it was referred to from a different original file before, we issue a warning. - // (Because it means the maps are not reliable.) - let projectLineMaps = - let checkAndAdd previousLinemaps surrIdx (newOrigIdx, linePairList as newLinemaps) = - match Map.tryFind surrIdx previousLinemaps with - | Some(origIdx, _) when origIdx <> newOrigIdx -> - let _, origLine = List.head linePairList - let m = mkFileIndexRange origIdx (mkPos origLine 0) (mkPos origLine 4) - - let getName idx = - FileIndex.fileOfFileIndex idx |> System.IO.Path.GetFileName |> string - - warning (Error(FSComp.SR.lexLineDirectiveMappingIsNotUnique (getName surrIdx, getName origIdx), m)) - | _ -> () - - Map.add surrIdx newLinemaps previousLinemaps - - Map.fold checkAndAdd projectData.LineMaps fileLineMaps - let newWarnScopeData = { ScopedNowarnFeatureIsSupported = scopedNowarnFeatureIsSupported ScriptNowarns = List.distinct (projectData.ScriptNowarns @ fileScriptNowarns) WarnScopes = projectWarnScopes - LineMaps = projectLineMaps } setWarnScopeData diagnosticOptions newWarnScopeData @@ -364,20 +298,6 @@ module internal WarnScopes = |> Option.bind (Map.tryFind warningNumber) |> Option.defaultValue [] - let private originalRange lineMaps (m: range) = - match Map.tryFind m.FileIndex lineMaps with - | None -> m - | Some(origFileIndex, sectionMaps) -> - let surrLine, origLine = - if List.isEmpty sectionMaps || m.StartLine < fst sectionMaps.Head then - (1, 1) - else - sectionMaps |> List.skipWhile (fun (s, _) -> m.StartLine < s) |> List.head - - let origStart = mkPos (m.StartLine + origLine - surrLine) m.StartColumn - let origEnd = mkPos (m.EndLine + origLine - surrLine) m.EndColumn - mkFileIndexRange origFileIndex origStart origEnd - // true if m1 contains the *start* of m2 // i.e. if the error range encloses the closing warn directive, we still say it is in scope let private contains (m2: range) (m1: range) = @@ -400,9 +320,8 @@ module internal WarnScopes = match mo, data.ScopedNowarnFeatureIsSupported with | Some m, true -> - let mOrig = originalRange data.LineMaps m - let scopes = getScopes mOrig.FileIndex warningNumber data.WarnScopes - List.exists (isEnclosingWarnonScope mOrig) scopes + let scopes = getScopes m.FileIndex warningNumber data.WarnScopes // LineDirectives: n/a + List.exists (isEnclosingWarnonScope m) scopes | _ -> false let IsNowarn (diagnosticOptions: FSharpDiagnosticOptions) warningNumber (mo: range option) = @@ -413,7 +332,6 @@ module internal WarnScopes = else match mo with | Some m -> - let mOrig = originalRange data.LineMaps m - let scopes = getScopes mOrig.FileIndex warningNumber data.WarnScopes - List.exists (isEnclosingNowarnScope mOrig) scopes + let scopes = getScopes m.FileIndex warningNumber data.WarnScopes // LineDirectives: n/a + List.exists (isEnclosingNowarnScope m) scopes | None -> false diff --git a/src/Compiler/SyntaxTree/WarnScopes.fsi b/src/Compiler/SyntaxTree/WarnScopes.fsi index 36539973a58..f6ae779da51 100644 --- a/src/Compiler/SyntaxTree/WarnScopes.fsi +++ b/src/Compiler/SyntaxTree/WarnScopes.fsi @@ -9,9 +9,6 @@ open FSharp.Compiler.UnicodeLexing module internal WarnScopes = - /// To be called during lexing to register the line directives for warn scope processing. - val internal RegisterLineDirective: lexbuf: Lexbuf * fileIndex: int * line: int -> unit - /// To be called during lexing to save #nowarn / #warnon directives. val ParseAndRegisterWarnDirective: lexbuf: Lexbuf -> unit diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs index ae35bc4f137..b9c33d8c739 100755 --- a/src/Compiler/Utilities/range.fs +++ b/src/Compiler/Utilities/range.fs @@ -261,6 +261,18 @@ module FileIndex = let startupFileName = "startup" let commandLineArgsFileName = "commandLineArgs" +[] +module internal LineDirectives = + + // For use in this module and in range.ApplyLineDirectives only. + // The key is the index of the original file. Each line directive is represented + // by the line number of the directive and the file index and line number of the target. + let mutable store: Map = Map.empty + + let add originalFileIndex lineDirectives = + lock lineDirectives + <| fun () -> store <- store.Add(originalFileIndex, lineDirectives) + [] [ {DebugCode}")>] type Range(code1: int64, code2: int64) = @@ -317,7 +329,25 @@ type Range(code1: int64, code2: int64) = member m.FileName = fileOfFileIndex m.FileIndex - member m.ShortFileName = Path.GetFileName(fileOfFileIndex m.FileIndex) + member m.ApplyLineDirectives() = + match LineDirectives.store.TryFind m.FileIndex with + | None -> m + | Some((directiveLine, _) :: _ as directives) when m.StartLine > directiveLine -> + let mStartLine = m.StartLine + + let directiveLine, (fileIndex, directiveTargetLine) = + directives + |> List.findBack (fun (directiveLine, _) -> mStartLine > directiveLine) + + let xOffset = directiveTargetLine - (directiveLine + 1) + + let r = + range (fileIndex, mStartLine + xOffset, m.StartColumn, m.EndLine + xOffset, m.EndColumn) + + let r = if m.IsSynthetic then r.MakeSynthetic() else r + let r = r.NoteSourceConstruct m.NotedSourceConstruct + r + | Some _ -> m member _.MakeSynthetic() = range (code1, code2 ||| isSyntheticMask) @@ -548,7 +578,8 @@ module Range = let endL, endC = startL + 1, 0 range (r.FileIndex, startL, startC, endL, endC) - let stringOfRange (r: range) = + let stringOfRange (m: range) = + let r = m.ApplyLineDirectives() sprintf "%s%s-%s" r.FileName (stringOfPos r.Start) (stringOfPos r.End) let toZ (m: range) = toZ m.Start, toZ m.End diff --git a/src/Compiler/Utilities/range.fsi b/src/Compiler/Utilities/range.fsi index ce6709697b0..b5b5ccd72cf 100755 --- a/src/Compiler/Utilities/range.fsi +++ b/src/Compiler/Utilities/range.fsi @@ -102,6 +102,9 @@ type Range = /// The file name for the file of the range member FileName: string + + /// Apply the line directives to the range. + member ApplyLineDirectives: unit -> range /// Synthetic marks ranges which are produced by intermediate compilation phases. This /// bit signifies that the range covers something that should not be visible to language @@ -185,6 +188,13 @@ module internal FileIndex = val startupFileName: string +[] +module internal LineDirectives = + + /// Add the line directive data of the source file with originalFileIndex. Each line directive is represented + /// by the line number of the directive and the file index and line number of the target. + val add: originalFileIndex: FileIndex -> lineDirectives: (int * (FileIndex * int)) list -> unit + module Range = /// Ordering on positions diff --git a/src/Compiler/lex.fsl b/src/Compiler/lex.fsl index c4aa041abc9..44ee8346fb8 100644 --- a/src/Compiler/lex.fsl +++ b/src/Compiler/lex.fsl @@ -818,15 +818,13 @@ rule token (args: LexArgs) (skip: bool) = parse // Construct the new position if args.applyLineDirectives then let fileIndex = match file with Some f -> FileIndex.fileIndexOfFile f | None -> pos.FileIndex - WarnScopes.RegisterLineDirective(lexbuf, fileIndex, line) - lexbuf.EndPos <- pos.ApplyLineDirective(fileIndex, line) - else - // add a newline when we don't apply a directive since we consumed a newline getting here - incrLine lexbuf + LineDirectiveStore.SaveLineDirective(lexbuf, fileIndex, line) + // we consumed a newline getting here + incrLine lexbuf token args skip lexbuf else - // add a newline when we don't apply a directive since we consumed a newline getting here + // we consumed a newline getting here incrLine lexbuf HASH_LINE (LexCont.Token (args.ifdefStack, args.stringNest)) } diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs index 105670d1adb..97badc07c4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs @@ -11,13 +11,14 @@ open FSharp.Compiler.Lexhelp open FSharp.Compiler.Syntax open FSharp.Compiler.Text open FSharp.Compiler.UnicodeLexing +open FSharp.Test.Compiler module Line = let parse (source: string) = let checker = FSharpChecker.Create() let langVersion = "preview" - let sourceFileName = __SOURCE_FILE__ + let sourceFileName = "Line.fs" let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| sourceFileName |] @@ -52,8 +53,8 @@ printfn "" [] [] - [] - [] + [] + [] let ``check expr range interacting with line directive`` (case, source, expectedRange) = let parseResults = parse source if parseResults.ParseHadErrors then failwith "unexpected: parse error" @@ -62,13 +63,64 @@ printfn "" | ParsedInput.ImplFile(ParsedImplFileInput(contents = contents)) -> let (SynModuleOrNamespace(decls = decls)) = List.exactlyOne contents match List.exactlyOne decls with - | SynModuleDecl.Expr(_, range) -> $"{range.FileName}:{range}" + | SynModuleDecl.Expr(_, range) -> + let range = range.ApplyLineDirectives() + $"{range.FileName}:{range}" | _ -> failwith $"unexpected: not an expr" | ParsedInput.SigFile _ -> failwith "unexpected: sig file" if exprRange <> expectedRange then failwith $"case{case}: expected: {expectedRange}, found {exprRange}" + [] + let TestLineDirectives () = + let source = + """ + module A + 3 + 4 + #line 5 "test.fsl" + 6 + 7 + #line 10 "test.fsy" + 9 + 10 + """ + let errors = + source + |> FSharp + |> withFileName "test.fs" + |> compile + |> shouldFail + |> fun cr -> cr.Output.PerFileErrors |> List.map (fun (fn, d) -> fn, d.Range.StartLine) + let expectedErrors = + [("test.fs", 3); ("test.fs", 4); ("test.fsl", 5); ("test.fsl", 6); ("test.fsy", 10); ("test.fsy", 11)] + Assert.True( + List.forall2 (fun (e_fn, e_line) (fn, line) -> e_fn = fn && e_line = line) expectedErrors errors, + sprintf "Expected: %A, Found: %A" expectedErrors errors + ) + + [] + let TestNoLineDirectives () = + let source = + """ + module A + 3 + 4 + """ + let errors = + source + |> FSharp + |> withFileName "test.fs" + |> compile + |> shouldFail + |> fun cr -> cr.Output.PerFileErrors |> List.map (fun (fn, d) -> fn, d.Range.StartLine) + let expectedErrors = + [("test.fs", 3); ("test.fs", 4)] + Assert.True( + List.forall2 (fun (e_fn, e_line) (fn, line) -> e_fn = fn && e_line = line) expectedErrors errors, + sprintf "Expected: %A, Found: %A" expectedErrors errors + ) @@ -89,8 +141,8 @@ printfn "" let tokenizer _ = let t = Lexer.token lexargs true lexbuf let p = lexbuf.StartPos - t, FileIndex.fileOfFileIndex p.FileIndex, p.OriginalLine, p.Line - let isNotEof(t,_,_,_) = match t with Parser.EOF _ -> false | _ -> true + t, FileIndex.fileOfFileIndex p.FileIndex, p.Line + let isNotEof(t,_,_) = match t with Parser.EOF _ -> false | _ -> true Seq.initInfinite tokenizer |> Seq.takeWhile isNotEof |> Seq.toList let private code = """ @@ -102,16 +154,15 @@ printfn "" """ let private expected = [ - "test.fs", 2, 2 - "other.fs", 4, 5 - "test.fs", 6, 10 + "test.fs", 2 + "test.fs", 4 + "test.fs", 6 ] [] let checkOriginalLineNumbers() = let tokens = getTokens code Assert.Equal(expected.Length, tokens.Length) - for ((e_idx, e_oLine, e_line), (_, idx, oLine, line)) in List.zip expected tokens do + for ((e_idx, e_line), (_, idx, line)) in List.zip expected tokens do Assert.Equal(e_idx, idx) - Assert.Equal(e_oLine, oLine) Assert.Equal(e_line, line) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs index dfbb6d3a735..850cc13c88e 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs @@ -147,28 +147,6 @@ module Nowarn = |> compile |> withDiags testId langVersion flags sources (Array.toList expectedDiags) - [] - let testBadLineDirectiveInteraction() = - let sources = - [ - "test1.fs", "module A1 \n#line 10 \"test.fsy\" \n()" - "test2.fs", "module A2 \n#line 20 \"test.fsy\" \n()" - ] - |> List.map (fun (name, text) -> {FileName = name; SourceText = Some text}) - |> List.map SourceCodeFileKind.Fs - let result = - sources.Head - |> fsFromString - |> FS - |> withAdditionalSourceFiles sources.Tail - |> compile - let actual = result.Output.Diagnostics - if actual.Length <> 1 then Assert.Fail $"expected 1 warning, got {actual.Length}" - let errorInfo = actual.Head - if errorInfo.Error <> Warning 3877 then Assert.Fail $"expected Warning 3877, got {errorInfo.Error}" - if errorInfo.Range.StartLine <> 3 then Assert.Fail $"expected warning in line 3, got line {errorInfo.Range.StartLine}" - if not <| errorInfo.Message.StartsWith "The file 'test.fsy' was also pointed to" then Assert.Fail $"unexpected message {errorInfo.Message}" - [] let warnDirectiveArgRange() = FSharp """ diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 4f1bda7afd1..7a508ad9696 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -10901,6 +10901,7 @@ FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position End FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position Start FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position get_End() FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position get_Start() +FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range ApplyLineDirectives() FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range EndRange FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range StartRange FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range Zero diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 703e5029e32..22277c45184 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -10897,6 +10897,7 @@ FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position End FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position Start FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position get_End() FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Position get_Start() +FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range ApplyLineDirectives() FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range EndRange FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range StartRange FSharp.Compiler.Text.Range: FSharp.Compiler.Text.Range Zero diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index c3bd9ca001d..906591fb042 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -5373,23 +5373,20 @@ let x = (1 = 3.0) [] let ``Test diagnostics with line directives active`` () = - // In background analysis and normal compiler checking, the errors are reported w.r.t. the line directives let wholeProjectResults = checker.ParseAndCheckProject(ProjectLineDirectives.options) |> Async.RunImmediate - for e in wholeProjectResults.Diagnostics do - printfn "ProjectLineDirectives wholeProjectResults error file: <<<%s>>>" e.Range.FileName - [ for e in wholeProjectResults.Diagnostics -> e.Range.StartLine, e.Range.EndLine, e.Range.FileName ] |> shouldEqual [(10, 10, "Test.fsy")] + [ for e in wholeProjectResults.Diagnostics -> + let m = e.Range in m.StartLine, m.EndLine, m.FileName ] + |> shouldEqual [10, 10, "Test.fsy"] let checkResults = checker.ParseAndCheckFileInProject(ProjectLineDirectives.fileName1, 0, ProjectLineDirectives.fileSource1, ProjectLineDirectives.options) |> Async.RunImmediate |> function _,FSharpCheckFileAnswer.Succeeded x -> x | _ -> failwith "unexpected aborted" - for e in checkResults.Diagnostics do - printfn "ProjectLineDirectives checkResults1 error file: <<<%s>>>" e.Range.FileName - - // No diagnostics for logical location "Test.fsy" are reported when checking the source since the filenames don't match. You need to pass --ignorelinedirectives to get them - [ for e in checkResults.Diagnostics -> e.Range.StartLine, e.Range.EndLine, e.Range.FileName ] |> shouldEqual [ ] + [ for e in checkResults.Diagnostics -> + let m = e.Range in m.StartLine, m.EndLine, m.FileName ] + |> shouldEqual [10, 10, "Test.fsy"] [] let ``Test diagnostics with line directives ignored`` () = @@ -5399,10 +5396,9 @@ let ``Test diagnostics with line directives ignored`` () = let options = { ProjectLineDirectives.options with OtherOptions = (Array.append ProjectLineDirectives.options.OtherOptions [| "--ignorelinedirectives" |]) } let wholeProjectResults = checker.ParseAndCheckProject(options) |> Async.RunImmediate - for e in wholeProjectResults.Diagnostics do - printfn "ProjectLineDirectives wholeProjectResults error file: <<<%s>>>" e.Range.FileName - - [ for e in wholeProjectResults.Diagnostics -> e.Range.StartLine, e.Range.EndLine, e.Range.FileName ] |> shouldEqual [(5, 5, ProjectLineDirectives.fileName1)] + [ for e in wholeProjectResults.Diagnostics -> + let m = e.Range.ApplyLineDirectives() in m.StartLine, m.EndLine, m.FileName ] + |> shouldEqual [(5, 5, ProjectLineDirectives.fileName1)] let checkResults = checker.ParseAndCheckFileInProject(ProjectLineDirectives.fileName1, 0, ProjectLineDirectives.fileSource1, options) @@ -5412,7 +5408,9 @@ let ``Test diagnostics with line directives ignored`` () = for e in checkResults.Diagnostics do printfn "ProjectLineDirectives checkResults error file: <<<%s>>>" e.Range.FileName - [ for e in checkResults.Diagnostics -> e.Range.StartLine, e.Range.EndLine, e.Range.FileName ] |> shouldEqual [(5, 5, ProjectLineDirectives.fileName1)] + [ for e in checkResults.Diagnostics -> + let m = e.Range.ApplyLineDirectives() in m.StartLine, m.EndLine, m.FileName ] + |> shouldEqual [(5, 5, ProjectLineDirectives.fileName1)] //------------------------------------------------------ diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl index c7384a6c7ba..e8c4bfc4379 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -37,8 +37,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getOptionArgList@307::Invoke([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x0000003E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getSwitch@325::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1780@1780::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1780@1780::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1782@1782::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1782@1782::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000065][found Byte] Unexpected type on the stack. @@ -59,7 +59,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@559::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@590::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index bc72e960ef4..838db1fdc7b 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -53,8 +53,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+processArg@333::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x0000004D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1780@1780::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1780@1780::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1782@1782::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1782@1782::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@570-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. @@ -84,7 +84,7 @@ [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@317::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@559::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@590::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl index dba0e14f752..81a1e0e4993 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -39,12 +39,12 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::attempt@372([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000A99][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1780::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1780::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1782::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1782::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1875-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1875'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.TypeProviders::ValidateExpectedName([FSharp.Compiler.Service]FSharp.Compiler.Text.Range, string[], string, [FSharp.Compiler.Service]FSharp.Compiler.Tainted`1)][offset 0x000000A8][found Char] Unexpected type on the stack. @@ -85,7 +85,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@559::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@590::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index ec773d8ba15..5bd1a9dec2d 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -55,14 +55,14 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::subSystemVersionSwitch$cont@656([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000026][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1780::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1780::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1782::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1782::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@568-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@568-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1875-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1875'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.NicePrint+TastDefinitionPrinting+meths@2092-3::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Infos+MethInfo)][offset 0x000000B3][found Char] Unexpected type on the stack. @@ -111,7 +111,7 @@ [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@316([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@559::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@590::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack. diff --git a/tests/fsharp/core/syntax/test.fsx b/tests/fsharp/core/syntax/test.fsx index c85225a5a73..ae34e2fc5cf 100644 --- a/tests/fsharp/core/syntax/test.fsx +++ b/tests/fsharp/core/syntax/test.fsx @@ -9,31 +9,10 @@ module Core_syntax let failures = ref false let report_failure () = stderr.WriteLine " NO"; failures := true -let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() +let test s b = stderr.Write(s:string); if b then stderr.WriteLine " OK" else report_failure() // Test the __LINE__ directive test "line number test" (__LINE__ = "15") -#line 100 -test "line number test" (__LINE__ = "100") - -#line 102 "file.fs" -test "line number test" (__LINE__ = "102") -test "line number test" (__SOURCE_FILE__ = "file.fs") - -#line 18 "original-test-file.fs" -test "line number test" (__LINE__ = "18") -test "line number test" (__SOURCE_FILE__ = "original-test-file.fs") - -# 100 -test "line number test" (__LINE__ = "100") - -# 102 "file.fs" -test "line number test" (__LINE__ = "102") -test "line number test" (__SOURCE_FILE__ = "file.fs") - -# 35 "original-test-file.fs" -test "line number test" (__LINE__ = "35") -test "line number test" (__SOURCE_FILE__ = "original-test-file.fs") let SimpleArithmetic( ) diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerFilePath.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerFilePath.fs index c44f97e4d53..6afea308b81 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerFilePath.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerFilePath.fs @@ -57,12 +57,12 @@ module Program = # 345 "qwerty1" match CallerInfoTest.AllInfo(123) with - | (path, _, _) when matchesPath "Conformance#SpecialAttributesAndTypes#Imported#CallerInfo#qwerty1" path -> () + | (path, _, _) when matchesPath "Conformance#SpecialAttributesAndTypes#Imported#CallerInfo#CallerFilePath.fs" path -> () | x -> failwithf "Unexpected C# result with multiple parameter types: %A" x # 456 "qwerty2" match CallerInfoTest.AllInfo(123) with - | (path, _, _) when matchesPath "Conformance#SpecialAttributesAndTypes#Imported#CallerInfo#qwerty2" path -> () + | (path, _, _) when matchesPath "Conformance#SpecialAttributesAndTypes#Imported#CallerInfo#CallerFilePath.fs" path -> () | x -> failwithf "Unexpected C# result with multiple parameter types: %A" x 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerLineNumber.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerLineNumber.fs index 4692802480b..58df0f7592d 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerLineNumber.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/CallerLineNumber.fs @@ -39,11 +39,11 @@ module Program = # 345 "qwerty" match CallerInfoTest.AllInfo(123) with - | (_, 345, _) -> () + | (_, 41, _) -> () | x -> failwithf "Unexpected C# result with multiple parameter types: %A" x # 456 "qwerty" match CallerInfoTest.AllInfo(123) with - | (_, 456, _) -> () + | (_, 45, _) -> () | x -> failwithf "Unexpected C# result with multiple parameter types: %A" x 0 \ No newline at end of file