Skip to content

Commit 8f3974f

Browse files
committed
fix bug with double lookup of cache
1 parent 46ec963 commit 8f3974f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/fsharp/InternalCollections.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i
6363

6464
let TryGetKeyValueImpl(data,key) =
6565
match TryPeekKeyValueImpl(data,key) with
66-
| Some(_, value) as result ->
67-
// If the result existed, move it to the top of the list.
68-
result,Promote (data,key,value)
66+
| Some(key', value) as result ->
67+
// If the result existed, move it to the end of the list (more likely to keep it)
68+
result,Promote (data,key',value)
6969
| None -> None,data
7070

7171
/// Remove weak entries from the list that have been collected

src/fsharp/vs/service.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
23542354
/// Parses the source file and returns untyped AST
23552355
member bc.ParseFileInProject(filename:string, source,options:FSharpProjectOptions) =
23562356
match locked (fun () -> parseFileInProjectCache.TryGet (filename, source, options)) with
2357-
| Some res -> async.Return res
2357+
| Some parseResults -> async.Return parseResults
23582358
| None ->
23592359
// Try this cache too (which might contain different entries)
23602360
let cachedResults = locked (fun () -> parseAndCheckFileInProjectCache.TryGet((filename,source,options)))
@@ -2365,7 +2365,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
23652365

23662366
// Try the caches again - it may have been filled by the time this operation runs
23672367
match locked (fun () -> parseFileInProjectCache.TryGet (filename, source, options)) with
2368-
| Some res -> res
2368+
| Some parseResults -> parseResults
23692369
| None ->
23702370
let cachedResults = locked (fun () -> parseAndCheckFileInProjectCache.TryGet((filename,source,options)))
23712371
match cachedResults with

0 commit comments

Comments
 (0)