diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 5d862a8960e..045921036c1 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -3146,12 +3146,14 @@ let ComputeQualifiedNameOfFileFromUniquePath (m, p: string list) = QualifiedName let QualFileNameOfSpecs filename specs = match specs with | [SynModuleOrNamespaceSig(modname,_,true,_,_,_,_,m)] -> QualFileNameOfModuleName m filename modname - | _ -> QualFileNameOfFilename (rangeN filename 1) filename + | [SynModuleOrNamespaceSig(_,_,false,_,_,_,_,m)] -> QualFileNameOfFilename m filename + | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let QualFileNameOfImpls filename specs = match specs with | [SynModuleOrNamespace(modname,_,true,_,_,_,_,m)] -> QualFileNameOfModuleName m filename modname - | _ -> QualFileNameOfFilename (rangeN filename 1) filename + | [SynModuleOrNamespace(_,_,false,_,_,_,_,m)] -> QualFileNameOfFilename m filename + | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let PrepandPathToQualFileName x (QualifiedNameOfFile(q)) = ComputeQualifiedNameOfFileFromUniquePath (q.idRange,pathOfLid x@[q.idText]) let PrepandPathToImpl x (SynModuleOrNamespace(p,b,c,d,e,f,g,h)) = SynModuleOrNamespace(x@p,b,c,d,e,f,g,h) diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs index 6ea0ae15d8b..18287fd1d99 100755 --- a/src/fsharp/range.fs +++ b/src/fsharp/range.fs @@ -212,7 +212,7 @@ let rangeContainsPos (m1:range) p = let rangeBeforePos (m1:range) p = posGeq p m1.End -let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 80) +let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 0) let pos0 = mkPos 1 0 let range0 = rangeN "unknown" 1 let rangeStartup = rangeN "startup" 1 diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index ba47d7e2529..e10e82c5b58 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -257,4 +257,4 @@ neg10.fs(456,24,456,25): typecheck error FS0001: The type 'C' does not support a neg10.fs(457,26,457,27): typecheck error FS0001: The type 'C' does not support a conversion to the type 'decimal' -neg10.fsi(1,1,1,81): typecheck error FS0240: The signature file 'Neg10' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match. +neg10.fsi(1,1,1,1): typecheck error FS0240: The signature file 'Neg10' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match. diff --git a/tests/fsharpqa/Source/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi b/tests/fsharpqa/Source/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi index 83feb860f5c..f5f53a17593 100644 --- a/tests/fsharpqa/Source/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi +++ b/tests/fsharpqa/Source/Conformance/ImplementationFilesAndSignatureFiles/SignatureFiles/E_MissingSourceFile01.fsi @@ -1,7 +1,7 @@ // #Regression #Conformance #SignatureFiles // Test you get an error if you specify an .fsi file but not the corresponding .fs file. -//The signature file 'E_MissingSourceFile01' does not have a corresponding implementation file\. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match +//The signature file 'E_MissingSourceFile01' does not have a corresponding implementation file\. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match namespace FSharp.Testing.MissingSourceFile01 diff --git a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs index 32816f8ea7c..886bea8bee9 100644 --- a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs +++ b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when multiple namespaces with multiple modules declared in source file -//Main module of program is empty: nothing will happen when it is run +//Main module of program is empty: nothing will happen when it is run #light namespace MyNamespace1 diff --git a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointModuleInNamespace.fs b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointModuleInNamespace.fs index faf53d678e9..ceaaceef2d3 100644 --- a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointModuleInNamespace.fs +++ b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointModuleInNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when single module declared inside namespace -//Main module of program is empty: nothing will happen when it is run +//Main module of program is empty: nothing will happen when it is run #light namespace MyNamespace1 diff --git a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointTypeInNamespace.fs b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointTypeInNamespace.fs index 738e43d131e..d83961f2101 100644 --- a/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointTypeInNamespace.fs +++ b/tests/fsharpqa/Source/EntryPoint/W_NoEntryPointTypeInNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when source file declares type inside namespace -//Main module of program is empty: nothing will happen when it is run +//Main module of program is empty: nothing will happen when it is run #light namespace MyNamespace1 diff --git a/tests/fsharpqa/Source/Warnings/FS0988AtEndOfFile.fs b/tests/fsharpqa/Source/Warnings/FS0988AtEndOfFile.fs new file mode 100644 index 00000000000..65b959a32fb --- /dev/null +++ b/tests/fsharpqa/Source/Warnings/FS0988AtEndOfFile.fs @@ -0,0 +1,7 @@ +// #Warnings +//Main module of program is empty: nothing will happen when it is run + +namespace MyNamespace1 + +module MyModule1 = + let irrelevant = 10 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 5fb27f22b53..1fc205b11d4 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -7,6 +7,7 @@ SOURCE=InvalidRecord.fs # InvalidRecord.fs SOURCE=CommaInRecCtor.fs # CommaInRecCtor.fs SOURCE=ValidCommaInRecCtor.fs # ValidCommaInRecCtor.fs + SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs SOURCE=WrongArity.fs # WrongArity.fs SOURCE=AccessOfTypeAbbreviation.fs # AccessOfTypeAbbreviation.fs SOURCE=AccessOfTypeAbbreviation2.fs # AccessOfTypeAbbreviation2.fs