From 3895e746b27d4e29fde39ee00ee1c258d1d56863 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 22 Jan 2015 13:24:13 +0100 Subject: [PATCH] Quickfix for #9 and #10 - second attempt --- src/fsharp/PrettyNaming.fs | 2 +- src/fsharp/ilxgen.fs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fsharp/PrettyNaming.fs b/src/fsharp/PrettyNaming.fs index 9b74deacf49b..6d4647ca87e2 100644 --- a/src/fsharp/PrettyNaming.fs +++ b/src/fsharp/PrettyNaming.fs @@ -387,7 +387,7 @@ module internal Microsoft.FSharp.Compiler.PrettyNaming let MangledGlobalName = "`global`" - let IllegalCharactersInTypeAndNamespaceNames = [| '.'; '+'; '$'; '&'; '['; ']'; '/'; '\\'; '*'; '\"'; '`' |] + let IllegalCharactersInTypeAndNamespaceNames = [| '.'; ','; '+'; '$'; '&'; '['; ']'; '/'; '\\'; '*'; '\"'; '`' |] let IsActivePatternName (nm:string) = (nm.IndexOf '|' = 0) && diff --git a/src/fsharp/ilxgen.fs b/src/fsharp/ilxgen.fs index 51ed6917eba7..17b09e6f989a 100644 --- a/src/fsharp/ilxgen.fs +++ b/src/fsharp/ilxgen.fs @@ -282,16 +282,16 @@ let NestedTypeRefForCompLoc cloc n = mkILTyRef(cloc.clocScope,tyname) | h::t -> mkILNestedTyRef(cloc.clocScope,mkTopName cloc.clocNamespace h :: t,n) -let CleanUpGeneratedTypeName (nm:string) = +let CleanUpGeneratedName (nm:string) = if nm.IndexOfAny IllegalCharactersInTypeAndNamespaceNames = -1 then nm else (nm,IllegalCharactersInTypeAndNamespaceNames) ||> Array.fold (fun nm c -> nm.Replace(string c, "-")) -let TypeNameForInitClass cloc = ".$" + cloc.clocTopImplQualifiedName +let TypeNameForInitClass cloc = ".$" + (CleanUpGeneratedName cloc.clocTopImplQualifiedName) let TypeNameForImplicitMainMethod cloc = TypeNameForInitClass cloc + "$Main" -let TypeNameForPrivateImplementationDetails cloc = "" +let TypeNameForPrivateImplementationDetails cloc = "" let CompLocForInitClass cloc = {cloc with clocEncl=[TypeNameForInitClass cloc]; clocNamespace=None} @@ -3881,7 +3881,7 @@ and GetIlxClosureFreeVars cenv m selfv eenvouter takenNames expr = // Choose a name for the closure let ilCloTypeRef = // FSharp 1.0 bug 3404: System.Reflection doesn't like '.' and '`' in type names - let basenameSafeForUseAsTypename = CleanUpGeneratedTypeName basename + let basenameSafeForUseAsTypename = CleanUpGeneratedName basename let suffixmark = expr.Range let cloName = globalStableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename,suffixmark,uniq) NestedTypeRefForCompLoc eenvouter.cloc cloName