Skip to content

Commit f613d5c

Browse files
committed
Fixed file names on Windows
1 parent 9e1cdc9 commit f613d5c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

fcs/fcs-fable/adapters.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ module System =
4545
new IEqualityComparer<'TKey> with
4646
member __.GetHashCode(x) = x.GetHashCode()
4747
member __.Equals(x, y) = x.Equals(y) }
48-
member x.TryAdd (key:'TKey, value:'TValue) = x.[key] <- value; true
48+
member x.TryAdd (key:'TKey, value:'TValue) =
49+
x.[key] <- value
50+
true
51+
member x.TryRemove (key:'TKey) =
52+
let res = x.TryGetValue(key)
53+
x.Remove(key) |> ignore
54+
res
4955
member x.GetOrAdd (key:'TKey, valueFactory: 'TKey -> 'TValue): 'TValue =
50-
match x.TryGetValue key with
56+
match x.TryGetValue(key) with
5157
| true, v -> v
5258
| false, _ -> let v = valueFactory(key) in x.[key] <- v; v
5359

fcs/fcs-fable/service_shim.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ type InteractiveChecker internal (tcConfig, tcGlobals, tcImports, tcInitialState
313313
| false, _ -> None)
314314
// remove all parse cache entries with the same file name
315315
let staleParseKeys = parseCache.Keys |> Seq.filter (fun (n,_) -> n = fileName) |> Seq.toArray
316-
staleParseKeys |> Array.iter (fun key -> parseCache.Remove(key) |> ignore)
316+
staleParseKeys |> Array.iter (fun key -> parseCache.TryRemove(key) |> ignore)
317317
checkCache.Clear(); // clear all typecheck cache
318318
// restore all cached typecheck entries above file
319319
cachedAbove |> Array.iter (fun (key, value) -> checkCache.TryAdd(key, value) |> ignore)
@@ -399,7 +399,7 @@ type InteractiveChecker internal (tcConfig, tcGlobals, tcImports, tcInitialState
399399
let fileNames = [| fileName |]
400400
let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, fileNames, false)
401401
let parseResults = x.ParseFile (fileName, source, parsingOptions)
402-
let moduleNamesDict = Map.Empty
402+
let moduleNamesDict = Map.empty
403403
let loadClosure = None
404404
let backgroundErrors = [||]
405405
let checkAlive () = true

fcs/fcs-fable/test/bench.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ open System.Text.RegularExpressions
44
open Microsoft.FSharp.Compiler.SourceCodeServices
55
open Platform
66

7-
let references = Metadata.references_core
7+
let references = Metadata.references false
88
let metadataPath = "/temp/repl/metadata2/" // .NET BCL binaries
99

1010
let parseProjectFile projectPath =
@@ -49,8 +49,8 @@ let rec parseProject projectPath =
4949
let (projectFileName, projectRefs, sourceFiles, defines) = parseProjectFile projectPath
5050

5151
let projectFileDir = Path.GetDirectoryName projectPath
52-
let isAbsolutePath (path: string) = path.StartsWith("/")
53-
let trimPath (path: string) = path.TrimStart([|'.';'/'|])
52+
let isAbsolutePath (path: string) = path.StartsWith("/") || path.Contains(":")
53+
let trimPath (path: string) = path.TrimStart([|'.';'/'|]).Replace(":", "")
5454
let makePath path = if isAbsolutePath path then path else Path.Combine(projectFileDir, path)
5555
let makeName path = Path.Combine(trimPath projectFileDir, trimPath path)
5656

0 commit comments

Comments
 (0)