Skip to content

Commit

Permalink
Quickfix for #9 and #10 - second attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jan 30, 2015
1 parent 3cd3c33 commit df654bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/fsharp/PrettyNaming.fs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ module internal Microsoft.FSharp.Compiler.PrettyNaming

let MangledGlobalName = "`global`"

let IllegalCharactersInTypeAndNamespaceNames = [| '.'; '+'; '$'; '&'; '['; ']'; '/'; '\\'; '*'; '\"'; '`' |]
let IllegalCharactersInTypeAndNamespaceNames = [| '.'; ','; '+'; '$'; '&'; '['; ']'; '/'; '\\'; '*'; '\"'; '`' |]

let IsActivePatternName (nm:string) =
(nm.IndexOf '|' = 0) &&
Expand Down
8 changes: 4 additions & 4 deletions src/fsharp/ilxgen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<StartupCode$" + (CleanUpGeneratedTypeName cloc.clocQualifiedNameOfFile) + ">.$" + cloc.clocTopImplQualifiedName
let TypeNameForInitClass cloc = "<StartupCode$" + (CleanUpGeneratedName cloc.clocQualifiedNameOfFile) + ">.$" + (CleanUpGeneratedName cloc.clocTopImplQualifiedName)
let TypeNameForImplicitMainMethod cloc = TypeNameForInitClass cloc + "$Main"
let TypeNameForPrivateImplementationDetails cloc = "<PrivateImplementationDetails$" + (CleanUpGeneratedTypeName cloc.clocQualifiedNameOfFile) + ">"
let TypeNameForPrivateImplementationDetails cloc = "<PrivateImplementationDetails$" + (CleanUpGeneratedName cloc.clocQualifiedNameOfFile) + ">"

let CompLocForInitClass cloc =
{cloc with clocEncl=[TypeNameForInitClass cloc]; clocNamespace=None}
Expand Down Expand Up @@ -3878,7 +3878,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
Expand Down

0 comments on commit df654bd

Please sign in to comment.