diff --git a/.executor-pid b/.executor-pid
new file mode 100644
index 00000000000..f4cce1bba91
--- /dev/null
+++ b/.executor-pid
@@ -0,0 +1 @@
+22280
\ No newline at end of file
diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt
index f9765bdbd6e..8900f874517 100644
--- a/src/Compiler/FSComp.txt
+++ b/src/Compiler/FSComp.txt
@@ -1818,4 +1818,5 @@ featurePreprocessorElif,"#elif preprocessor directive"
3885,parsLetBangCannotBeLastInCE,"'%s' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression."
3886,tcListLiteralWithSingleTupleElement,"This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements?"
3887,ilCustomAttrInvalidArrayElemType,"The type '%s' is not a valid custom attribute argument type. Custom attribute arrays must have elements of primitive types, enums, string, System.Type, or System.Object."
+3888,tastNamespaceAndTypeWithSameNameInAssembly,"The namespace '%s' clashes with the type '%s'."
featureExceptionFieldSerializationSupport,"emit GetObjectData and field-restoring deserialization constructor for exception types"
diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs
index ed1a4da5bf5..35bbe6e884e 100644
--- a/src/Compiler/Service/ServiceParsedInputOps.fs
+++ b/src/Compiler/Service/ServiceParsedInputOps.fs
@@ -2602,17 +2602,55 @@ module ParsedInput =
mkPos line ctx.Pos.Column
+ let private tryFindLastHashRLineInScript (parsedInput: ParsedInput) =
+ if
+ not (
+ parsedInput.FileName.EndsWith(".fsx", System.StringComparison.OrdinalIgnoreCase)
+ || parsedInput.FileName.EndsWith(".fsscript", System.StringComparison.OrdinalIgnoreCase)
+ )
+ then
+ None
+ else
+ match parsedInput with
+ | ParsedInput.SigFile _ -> None
+ | ParsedInput.ImplFile(ParsedImplFileInput(hashDirectives = fileHashes; contents = contents)) ->
+ let mutable lastLine = 0
+
+ let consider (ParsedHashDirective(ident, _, r)) =
+ if ident = "r" && r.EndLine > lastLine then
+ lastLine <- r.EndLine
+
+ fileHashes |> List.iter consider
+
+ let rec walkDecl (decl: SynModuleDecl) =
+ match decl with
+ | SynModuleDecl.HashDirective(hashDirective = hd) -> consider hd
+ | SynModuleDecl.NestedModule(decls = decls) -> List.iter walkDecl decls
+ | SynModuleDecl.NamespaceFragment(SynModuleOrNamespace(decls = decls)) -> List.iter walkDecl decls
+ | _ -> ()
+
+ for SynModuleOrNamespace(decls = decls) in contents do
+ List.iter walkDecl decls
+
+ if lastLine > 0 then Some lastLine else None
+
let FindNearestPointToInsertOpenDeclaration
(currentLine: int)
(parsedInput: ParsedInput)
(entity: ShortIdents)
(insertionPoint: OpenStatementInsertionPoint)
=
- match tryFindNearestPointAndModules currentLine parsedInput insertionPoint with
- | Some(scope, _, point), modules -> findBestPositionToInsertOpenDeclaration modules scope point entity
- | _ ->
- // we failed to find insertion point because ast is empty for some reason, return top left point in this case
- {
- ScopeKind = ScopeKind.TopModule
- Pos = mkPos 1 0
- }
+ let ctx =
+ match tryFindNearestPointAndModules currentLine parsedInput insertionPoint with
+ | Some(scope, _, point), modules -> findBestPositionToInsertOpenDeclaration modules scope point entity
+ | _ ->
+ // we failed to find insertion point because ast is empty for some reason, return top left point in this case
+ {
+ ScopeKind = ScopeKind.TopModule
+ Pos = mkPos 1 0
+ }
+
+ // For .fsx scripts, ensure the open is placed after any #r directives.
+ match tryFindLastHashRLineInScript parsedInput with
+ | Some lastRLine when ctx.Pos.Line <= lastRLine -> { ctx with Pos = mkPos (lastRLine + 1) 0 }
+ | _ -> ctx
diff --git a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs
index de28bc34138..4720e0e0ab8 100644
--- a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs
+++ b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs
@@ -622,8 +622,11 @@ module internal SignatureOps =
match entity1.IsNamespace, entity2.IsNamespace, entity1.IsModule, entity2.IsModule with
| true, true, _, _ -> ()
+ | true, _, _, true
+ | _, true, true, _ -> errorR (Error(FSComp.SR.tastNamespaceAndModuleWithSameNameInAssembly (textOfPath path2), entity2.Range))
| true, _, _, _
- | _, true, _, _ -> errorR (Error(FSComp.SR.tastNamespaceAndModuleWithSameNameInAssembly (textOfPath path2), entity2.Range))
+ | _, true, _, _ ->
+ errorR (Error(FSComp.SR.tastNamespaceAndTypeWithSameNameInAssembly (textOfPath path2, entity2.LogicalName), entity2.Range))
| false, false, false, false ->
errorR (Error(FSComp.SR.tastDuplicateTypeDefinitionInAssembly (entity2.LogicalName, textOfPath path), entity2.Range))
| false, false, true, true -> errorR (Error(FSComp.SR.tastTwoModulesWithSameNameInAssembly (textOfPath path2), entity2.Range))
diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf
index 10fe84e6ab1..ab2d8c44957 100644
--- a/src/Compiler/xlf/FSComp.txt.cs.xlf
+++ b/src/Compiler/xlf/FSComp.txt.cs.xlf
@@ -1352,6 +1352,11 @@
(Navržený název)
+
+ The namespace '{0}' clashes with the type '{1}'.
+ The namespace '{0}' clashes with the type '{1}'.
+
+ Access modifiers cannot be applied to an SRTP constraint.Access modifiers cannot be applied to an SRTP constraint.
@@ -8972,21 +8977,21 @@
This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments.
-
- '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression.
- '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression.
-
-
-
- This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements?
- This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements?
-
-
-
- emit GetObjectData and field-restoring deserialization constructor for exception types
- emit GetObjectData and field-restoring deserialization constructor for exception types
-
-
+
+ '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression.
+ '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression.
+
+
+
+ This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements?
+ This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements?
+
+
+
+ emit GetObjectData and field-restoring deserialization constructor for exception types
+ emit GetObjectData and field-restoring deserialization constructor for exception types
+
+