@@ -485,11 +485,11 @@ namespace ts {
485
485
486
486
function sourceFileNotUptoDate ( sourceFile : SourceFile ) {
487
487
return ! sourceFileVersionUptoDate ( sourceFile ) ||
488
- hasInvalidatedResolution ( sourceFile . resolvedPath || sourceFile . path ) ;
488
+ hasInvalidatedResolution ( sourceFile . resolvedPath ) ;
489
489
}
490
490
491
491
function sourceFileVersionUptoDate ( sourceFile : SourceFile ) {
492
- return sourceFile . version === getSourceVersion ( sourceFile . resolvedPath || sourceFile . path ) ;
492
+ return sourceFile . version === getSourceVersion ( sourceFile . resolvedPath ) ;
493
493
}
494
494
495
495
function projectReferenceUptoDate ( oldRef : ProjectReference , newRef : ProjectReference , index : number ) {
@@ -1079,7 +1079,7 @@ namespace ts {
1079
1079
1080
1080
for ( const oldSourceFile of oldSourceFiles ) {
1081
1081
let newSourceFile = host . getSourceFileByPath
1082
- ? host . getSourceFileByPath ( oldSourceFile . fileName , oldSourceFile . resolvedPath || oldSourceFile . path , options . target ! , /*onError*/ undefined , shouldCreateNewSourceFile )
1082
+ ? host . getSourceFileByPath ( oldSourceFile . fileName , oldSourceFile . resolvedPath , options . target ! , /*onError*/ undefined , shouldCreateNewSourceFile )
1083
1083
: host . getSourceFile ( oldSourceFile . fileName , options . target ! , /*onError*/ undefined , shouldCreateNewSourceFile ) ; // TODO: GH#18217
1084
1084
1085
1085
if ( ! newSourceFile ) {
@@ -1110,7 +1110,11 @@ namespace ts {
1110
1110
fileChanged = newSourceFile !== oldSourceFile ;
1111
1111
}
1112
1112
1113
+ // Since the project references havent changed, its right to set originalFileName and resolvedPath here
1113
1114
newSourceFile . path = oldSourceFile . path ;
1115
+ newSourceFile . originalFileName = oldSourceFile . originalFileName ;
1116
+ newSourceFile . resolvedPath = oldSourceFile . resolvedPath ;
1117
+ newSourceFile . fileName = oldSourceFile . fileName ;
1114
1118
filePaths . push ( newSourceFile . path ) ;
1115
1119
1116
1120
const packageName = oldProgram . sourceFileToPackageName . get ( oldSourceFile . path ) ;
@@ -1187,7 +1191,7 @@ namespace ts {
1187
1191
modifiedFilePaths = modifiedSourceFiles . map ( f => f . newFile . path ) ;
1188
1192
// try to verify results of module resolution
1189
1193
for ( const { oldFile : oldSourceFile , newFile : newSourceFile } of modifiedSourceFiles ) {
1190
- const newSourceFilePath = getNormalizedAbsolutePath ( newSourceFile . fileName , currentDirectory ) ;
1194
+ const newSourceFilePath = getNormalizedAbsolutePath ( newSourceFile . originalFileName , currentDirectory ) ;
1191
1195
if ( resolveModuleNamesWorker ) {
1192
1196
const moduleNames = getModuleNames ( newSourceFile ) ;
1193
1197
const oldProgramState : OldProgramState = { program : oldProgram , oldSourceFile, modifiedFilePaths } ;
@@ -2040,6 +2044,7 @@ namespace ts {
2040
2044
2041
2045
// Get source file from normalized fileName
2042
2046
function findSourceFile ( fileName : string , path : Path , isDefaultLib : boolean , ignoreNoDefaultLib : boolean , refFile : SourceFile , refPos : number , refEnd : number , packageId : PackageId | undefined ) : SourceFile | undefined {
2047
+ const originalFileName = fileName ;
2043
2048
if ( filesByName . has ( path ) ) {
2044
2049
const file = filesByName . get ( path ) ;
2045
2050
// try to check if we've already seen this file but with a different casing in path
@@ -2136,6 +2141,7 @@ namespace ts {
2136
2141
sourceFilesFoundSearchingNodeModules . set ( path , currentNodeModulesDepth > 0 ) ;
2137
2142
file . path = path ;
2138
2143
file . resolvedPath = toPath ( fileName ) ;
2144
+ file . originalFileName = originalFileName ;
2139
2145
2140
2146
if ( host . useCaseSensitiveFileNames ( ) ) {
2141
2147
const pathLowerCase = path . toLowerCase ( ) ;
@@ -2203,7 +2209,7 @@ namespace ts {
2203
2209
return ;
2204
2210
}
2205
2211
2206
- const resolutions = resolveTypeReferenceDirectiveNamesWorker ( typeDirectives , file . fileName ) ;
2212
+ const resolutions = resolveTypeReferenceDirectiveNamesWorker ( typeDirectives , file . originalFileName ) ;
2207
2213
2208
2214
for ( let i = 0 ; i < typeDirectives . length ; i ++ ) {
2209
2215
const ref = file . typeReferenceDirectives [ i ] ;
@@ -2299,7 +2305,7 @@ namespace ts {
2299
2305
// Because global augmentation doesn't have string literal name, we can check for global augmentation as such.
2300
2306
const moduleNames = getModuleNames ( file ) ;
2301
2307
const oldProgramState : OldProgramState = { program : oldProgram , oldSourceFile : oldProgram && oldProgram . getSourceFile ( file . fileName ) , modifiedFilePaths } ;
2302
- const resolutions = resolveModuleNamesReusingOldState ( moduleNames , getNormalizedAbsolutePath ( file . fileName , currentDirectory ) , file , oldProgramState ) ;
2308
+ const resolutions = resolveModuleNamesReusingOldState ( moduleNames , getNormalizedAbsolutePath ( file . originalFileName , currentDirectory ) , file , oldProgramState ) ;
2303
2309
Debug . assert ( resolutions . length === moduleNames . length ) ;
2304
2310
for ( let i = 0 ; i < moduleNames . length ; i ++ ) {
2305
2311
const resolution = resolutions [ i ] ;
0 commit comments