@@ -1427,8 +1427,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
14271427 errorLogger.Warning( e)
14281428 frameworkTcImports
14291429
1430- let tcEnvAtEndOfFile = GetInitialTcEnv( assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
1431- let tcState = GetInitialTcState( rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, niceNameGen, tcEnvAtEndOfFile )
1430+ let tcInitial = GetInitialTcEnv( assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
1431+ let tcState = GetInitialTcState( rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, niceNameGen, tcInitial )
14321432let loadClosureErrors =
14331433[ match loadClosureOptwith
14341434| None-> ()
@@ -1442,7 +1442,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
14421442 tcImports= tcImports
14431443 tcState= tcState
14441444 tcConfig= tcConfig
1445- tcEnvAtEndOfFile= tcEnvAtEndOfFile
1445+ tcEnvAtEndOfFile= tcInitial
14461446 tcResolutions=[]
14471447 tcSymbolUses=[]
14481448 topAttribs= None
@@ -1479,6 +1479,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
14791479/// Only keep the typed interface files when doing a "full" build for fsc.exe, otherwise just throw them away
14801480let typedImplFiles = if keepAssemblyContentsthen typedImplFileselse []
14811481let tcResolutions = if keepAllBackgroundResolutionsthen sink.GetResolutions() else TcResolutions.Empty
1482+ let tcEnvAtEndOfFile = ( if keepAllBackgroundResolutionsthen tcEnvAtEndOfFileelse tcState.TcEnvFromImpls)
14821483let tcSymbolUses = sink.GetSymbolUses()
14831484 fileChecked.Trigger( filename)
14841485return { tcAccwith tcState= tcState