diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 839d7b4d631..e140b3351f5 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -102,7 +102,7 @@ let ConsoleErrorLoggerUpToMaxErrors (tcConfigB: TcConfigBuilder, exiter : Exiter member __.HandleIssue(tcConfigB, err, isError) = DoWithErrorColor isError (fun () -> let diag = OutputDiagnostic (tcConfigB.implicitIncludeDir, tcConfigB.showFullPaths, tcConfigB.flatErrors, tcConfigB.errorStyle, isError) - writeViaBufferWithEnvironmentNewLines stderr diag err + writeViaBuffer stderr diag err stderr.WriteLine()) } :> ErrorLogger @@ -316,7 +316,7 @@ module InterfaceFileWriter = for (TImplFile (_, _, mexpr, _, _, _)) in declaredImpls do let denv = BuildInitialDisplayEnvForSigFileGeneration tcGlobals - writeViaBufferWithEnvironmentNewLines os (fun os s -> Printf.bprintf os "%s\n\n" s) + writeViaBuffer os (fun os s -> Printf.bprintf os "%s\n\n" s) (NicePrint.layoutInferredSigOfModuleExpr true denv infoReader AccessibleFromSomewhere range0 mexpr |> Layout.squashTo 80 |> Layout.showL) if tcConfig.printSignatureFile <> "" then os.Dispose() diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index cd43753ab50..9f6df3f16a9 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -502,8 +502,8 @@ type internal FsiStdinSyphon(errorWriter: TextWriter) = let isError = true DoWithErrorColor isError (fun () -> errorWriter.WriteLine(); - writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnosticContext " " syphon.GetLine) err; - writeViaBufferWithEnvironmentNewLines errorWriter (OutputDiagnostic (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,isError)) err; + writeViaBuffer errorWriter (OutputDiagnosticContext " " syphon.GetLine) err; + writeViaBuffer errorWriter (OutputDiagnostic (tcConfig.implicitIncludeDir,tcConfig.showFullPaths,tcConfig.flatErrors,tcConfig.errorStyle,isError)) err; errorWriter.WriteLine() errorWriter.WriteLine() errorWriter.Flush())) @@ -548,8 +548,8 @@ type internal ErrorLoggerThatStopsOnFirstError(tcConfigB:TcConfigBuilder, fsiStd DoWithErrorColor isError (fun () -> if ReportWarning tcConfigB.errorSeverityOptions err then fsiConsoleOutput.Error.WriteLine() - writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputDiagnosticContext " " fsiStdinSyphon.GetLine) err - writeViaBufferWithEnvironmentNewLines fsiConsoleOutput.Error (OutputDiagnostic (tcConfigB.implicitIncludeDir,tcConfigB.showFullPaths,tcConfigB.flatErrors,tcConfigB.errorStyle,isError)) err + writeViaBuffer fsiConsoleOutput.Error (OutputDiagnosticContext " " fsiStdinSyphon.GetLine) err + writeViaBuffer fsiConsoleOutput.Error (OutputDiagnostic (tcConfigB.implicitIncludeDir,tcConfigB.showFullPaths,tcConfigB.flatErrors,tcConfigB.errorStyle,isError)) err fsiConsoleOutput.Error.WriteLine() fsiConsoleOutput.Error.WriteLine() fsiConsoleOutput.Error.Flush()) diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index b9653f35c7d..2b9d584bdc4 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -313,19 +313,12 @@ let bufs f = f buf buf.ToString() -let buff (os: TextWriter) f x = +// writing to output stream via a string buffer. +let writeViaBuffer (os: TextWriter) f x = let buf = System.Text.StringBuilder 100 f buf x os.Write(buf.ToString()) -// Converts "\n" into System.Environment.NewLine before writing to os. See lib.fs:buff -let writeViaBufferWithEnvironmentNewLines (os: TextWriter) f x = - let buf = System.Text.StringBuilder 100 - f buf x - let text = buf.ToString() - let text = text.Replace("\n", System.Environment.NewLine) - os.Write text - //--------------------------------------------------------------------------- // Imperative Graphs //--------------------------------------------------------------------------- diff --git a/tests/fsharp/core/load-script/out.stderr.bsl b/tests/fsharp/core/load-script/out.stderr.bsl index 0c48e3a9444..3090d5e2f89 100644 --- a/tests/fsharp/core/load-script/out.stderr.bsl +++ b/tests/fsharp/core/load-script/out.stderr.bsl @@ -1,4 +1,3 @@ usesfsi.fsx(2,1): error FS0039: The value, namespace, type or module 'fsi' is not defined. Maybe you want one of the following: - fst diff --git a/tests/fsharp/typecheck/sigs/neg04.bsl b/tests/fsharp/typecheck/sigs/neg04.bsl index 058e3226a02..77df1028d21 100644 --- a/tests/fsharp/typecheck/sigs/neg04.bsl +++ b/tests/fsharp/typecheck/sigs/neg04.bsl @@ -12,7 +12,6 @@ neg04.fs(22,8,22,17): typecheck error FS0912: This declaration element is not pe neg04.fs(26,8,26,17): typecheck error FS0912: This declaration element is not permitted in an augmentation neg04.fs(32,8,32,11): typecheck error FS0039: The field, constructor or member 'Nan' is not defined. Maybe you want one of the following: - IsNaN neg04.fs(46,69,46,94): typecheck error FS0001: Type mismatch. Expecting a diff --git a/tests/fsharp/typecheck/sigs/neg06.bsl b/tests/fsharp/typecheck/sigs/neg06.bsl index bd3a528947b..f7fe3615e41 100644 --- a/tests/fsharp/typecheck/sigs/neg06.bsl +++ b/tests/fsharp/typecheck/sigs/neg06.bsl @@ -1,6 +1,5 @@ neg06.fs(3,40,3,45): typecheck error FS0039: The field, constructor or member 'Ascii' is not defined. Maybe you want one of the following: - ASCII neg06.fs(12,6,12,31): typecheck error FS0942: Struct types are always sealed diff --git a/tests/fsharp/typecheck/sigs/neg07.bsl b/tests/fsharp/typecheck/sigs/neg07.bsl index af0466dd3f0..614d9b222a6 100644 --- a/tests/fsharp/typecheck/sigs/neg07.bsl +++ b/tests/fsharp/typecheck/sigs/neg07.bsl @@ -4,7 +4,6 @@ neg07.fs(7,10,7,29): typecheck error FS0049: Uppercase variable identifiers shou neg07.fs(7,10,7,29): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name. neg07.fs(24,13,24,23): typecheck error FS0039: The value or constructor 'UnionCase1' is not defined. Maybe you want one of the following: - X.UnionCase1 neg07.fs(27,11,27,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name. @@ -14,7 +13,6 @@ neg07.fs(28,11,28,21): typecheck error FS0049: Uppercase variable identifiers sh neg07.fs(28,11,28,21): typecheck error FS0026: This rule will never be matched neg07.fs(31,18,31,28): typecheck error FS0039: The value or constructor 'UnionCase1' is not defined. Maybe you want one of the following: - X.UnionCase1 neg07.fs(35,11,35,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name. @@ -24,11 +22,9 @@ neg07.fs(36,11,36,21): typecheck error FS0049: Uppercase variable identifiers sh neg07.fs(36,11,36,21): typecheck error FS0026: This rule will never be matched neg07.fs(46,15,46,27): typecheck error FS0039: The record label 'RecordLabel1' is not defined. Maybe you want one of the following: - R.RecordLabel1 neg07.fs(47,19,47,31): typecheck error FS0039: The record label 'RecordLabel1' is not defined. Maybe you want one of the following: - R.RecordLabel1 neg07.fs(57,10,57,17): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index c31220273da..2e94ef5bd9b 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -63,9 +63,7 @@ neg10.fs(169,32,169,35): typecheck error FS0035: This construct is deprecated: T neg10.fs(169,32,169,33): typecheck error FS3213: The member 'X : unit -> 'a' matches multiple overloads of the same method. Please restrict it to one of the following: - X : unit -> 'a - X : unit -> 'a. neg10.fs(169,19,169,26): typecheck error FS0783: At least one override did not correctly implement its corresponding abstract member diff --git a/tests/fsharp/typecheck/sigs/neg111.bsl b/tests/fsharp/typecheck/sigs/neg111.bsl index afe770b8fdc..c5048f7c299 100644 --- a/tests/fsharp/typecheck/sigs/neg111.bsl +++ b/tests/fsharp/typecheck/sigs/neg111.bsl @@ -4,11 +4,8 @@ neg111.fs(2,552,2,557): typecheck error FS0039: The type 'fail1' is not defined. neg111.fs(2,552,2,557): typecheck error FS0039: The type 'fail1' is not defined. neg111.fs(3,624,3,629): typecheck error FS0039: The value or constructor 'fail2' is not defined. Maybe you want one of the following: - Failure - failwith - failwithf neg111.fs(5,538,5,540): typecheck error FS0003: This value is not a function and cannot be applied. diff --git a/tests/fsharp/typecheck/sigs/neg15.bsl b/tests/fsharp/typecheck/sigs/neg15.bsl index c8c59c1dc29..92d49dd44a1 100644 --- a/tests/fsharp/typecheck/sigs/neg15.bsl +++ b/tests/fsharp/typecheck/sigs/neg15.bsl @@ -30,21 +30,15 @@ neg15.fs(115,19,115,48): typecheck error FS0072: Lookup on object of indetermina neg15.fs(116,20,116,73): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. neg15.fs(122,32,122,57): typecheck error FS0039: The value, constructor, namespace or type 'InternalTagOfInternalType' is not defined. Maybe you want one of the following: - InternalUnionType - InternalRecordType - DefaultTagOfInternalType neg15.fs(128,31,128,61): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. neg15.fs(135,31,135,56): typecheck error FS0039: The value, constructor, namespace or type 'InternalTagOfInternalType' is not defined. Maybe you want one of the following: - InternalUnionType - InternalRecordType - DefaultTagOfInternalType neg15.fs(141,30,141,60): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. diff --git a/tests/fsharp/typecheck/sigs/neg17.bsl b/tests/fsharp/typecheck/sigs/neg17.bsl index 499430cdaa7..4fa0cd39c5c 100644 --- a/tests/fsharp/typecheck/sigs/neg17.bsl +++ b/tests/fsharp/typecheck/sigs/neg17.bsl @@ -8,13 +8,11 @@ neg17b.fs(8,18,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not neg17b.fs(11,26,11,41): typecheck error FS0039: The field, constructor or member 'PrivateProperty' is not defined. neg17b.fs(12,24,12,45): typecheck error FS0039: The field, constructor or member 'PrivateStaticProperty' is not defined. Maybe you want one of the following: - InternalStaticProperty neg17b.fs(13,26,13,39): typecheck error FS0039: The field, constructor or member 'PrivateMethod' is not defined. neg17b.fs(14,24,14,43): typecheck error FS0039: The field, constructor or member 'PrivateStaticMethod' is not defined. Maybe you want one of the following: - InternalStaticMethod neg17b.fs(15,17,15,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location @@ -26,9 +24,7 @@ neg17b.fs(16,19,16,48): typecheck error FS0072: Lookup on object of indeterminat neg17b.fs(17,19,17,47): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. neg17b.fs(21,31,21,77): typecheck error FS0039: The value, constructor, namespace or type 'DefaultTagOfUnionTypeWithPrivateRepresentation' is not defined. Maybe you want one of the following: - DefaultTagOfInternalType - UnionTypeWithPrivateRepresentation neg17b.fs(29,31,29,61): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. @@ -36,13 +32,11 @@ neg17b.fs(29,31,29,61): typecheck error FS0072: Lookup on object of indeterminat neg17b.fs(30,31,30,84): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. neg17b.fs(32,24,32,50): typecheck error FS0039: The type 'RecordTypeWithPrivateField' is not defined in 'Neg17.M'. Maybe you want one of the following: - RecordTypeWithPrivateRepresentation neg17b.fs(43,30,43,60): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. neg17b.fs(45,23,45,49): typecheck error FS0039: The type 'RecordTypeWithPrivateField' is not defined in 'Neg17.M'. Maybe you want one of the following: - RecordTypeWithPrivateRepresentation neg17b.fs(54,20,54,50): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. diff --git a/tests/fsharp/typecheck/sigs/neg25.bsl b/tests/fsharp/typecheck/sigs/neg25.bsl index 6a9653c42dc..ebbf45ae77b 100644 --- a/tests/fsharp/typecheck/sigs/neg25.bsl +++ b/tests/fsharp/typecheck/sigs/neg25.bsl @@ -10,11 +10,8 @@ neg25.fs(87,19,87,25): typecheck error FS0366: No implementation was given for ' neg25.fs(104,19,104,27): typecheck error FS0366: No implementation was given for 'abstract member AnotherNegativeTest.ITestSub.Meth1 : int -> int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'. neg25.fs(126,27,126,35): typecheck error FS0366: No implementation was given for those members: - 'abstract member MissingInterfaceMemberTests.Test0.ITestSub.Meth2 : int -> int' - 'abstract member MissingInterfaceMemberTests.Test0.ITest.Meth1 : string -> string' - Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'. neg25.fs(147,27,147,35): typecheck error FS0366: No implementation was given for 'abstract member MissingInterfaceMemberTests.Test1.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'. diff --git a/tests/fsharp/typecheck/sigs/neg26.bsl b/tests/fsharp/typecheck/sigs/neg26.bsl index d17ba9ed7ee..74a0337d928 100644 --- a/tests/fsharp/typecheck/sigs/neg26.bsl +++ b/tests/fsharp/typecheck/sigs/neg26.bsl @@ -7,9 +7,7 @@ neg26.fs(40,27,40,32): typecheck error FS0361: The override 'Meth1 : int -> int' neg26.fs(53,27,53,32): typecheck error FS3213: The member 'Meth1 : 'a -> 'a' matches multiple overloads of the same method. Please restrict it to one of the following: - Meth1 : int -> int - Meth1 : int -> int. neg26.fs(52,15,52,23): typecheck error FS0783: At least one override did not correctly implement its corresponding abstract member diff --git a/tests/fsharp/typecheck/sigs/neg99.bsl b/tests/fsharp/typecheck/sigs/neg99.bsl index 6482281b893..9f6010f249d 100644 --- a/tests/fsharp/typecheck/sigs/neg99.bsl +++ b/tests/fsharp/typecheck/sigs/neg99.bsl @@ -3,4 +3,4 @@ neg99.fs(19,16,19,64): typecheck error FS0077: Member constraints with the name neg99.fs(22,18,22,64): typecheck error FS0077: Member constraints with the name 'op_Explicit' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code. -neg99.fs(25,39,25,43): typecheck error FS0043: The type 'CrashFSC.OhOh.MyByte' does not support a conversion to the type 'CrashFSC.OhOh.MyByte' \ No newline at end of file +neg99.fs(25,39,25,43): typecheck error FS0043: The type 'CrashFSC.OhOh.MyByte' does not support a conversion to the type 'CrashFSC.OhOh.MyByte' diff --git a/tests/fsharp/typecheck/sigs/version46/neg24.bsl b/tests/fsharp/typecheck/sigs/version46/neg24.bsl index 96a64e8c88f..b782269bb54 100644 --- a/tests/fsharp/typecheck/sigs/version46/neg24.bsl +++ b/tests/fsharp/typecheck/sigs/version46/neg24.bsl @@ -27,4 +27,4 @@ neg24.fs(62,31,62,41): typecheck error FS0816: One or more of the overloads of t neg24.fs(64,44,64,48): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int. \ No newline at end of file +neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int.