@@ -3580,24 +3580,31 @@ module ts {
35803580 return filter ( errors , e => ! e . file ) ;
35813581 }
35823582
3583- function addExtension ( filename : string , extension : string ) : string {
3584- return getBaseFilename ( filename ) . indexOf ( "." ) >= 0 ? filename : filename + extension ;
3583+ function hasExtension ( filename : string ) : boolean {
3584+ return getBaseFilename ( filename ) . indexOf ( "." ) >= 0 ;
35853585 }
35863586
35873587 function processRootFile ( filename : string , isDefaultLib : boolean ) {
3588- processSourceFile ( normalizePath ( addExtension ( filename , ".ts" ) ) , isDefaultLib ) ;
3588+ processSourceFile ( normalizePath ( filename ) , isDefaultLib ) ;
35893589 }
35903590
35913591 function processSourceFile ( filename : string , isDefaultLib : boolean , refFile ?: SourceFile , refPos ?: number , refEnd ?: number ) {
35923592 if ( refEnd !== undefined && refPos !== undefined ) {
35933593 var start = refPos ;
35943594 var length = refEnd - refPos ;
35953595 }
3596- if ( ! fileExtensionIs ( filename , ".ts" ) ) {
3597- errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_must_have_extension_ts_or_d_ts , filename ) ) ;
3596+ if ( hasExtension ( filename ) ) {
3597+ if ( ! fileExtensionIs ( filename , ".ts" ) ) {
3598+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_must_have_extension_ts_or_d_ts , filename ) ) ;
3599+ }
3600+ else if ( ! findSourceFile ( filename , isDefaultLib , refFile , refPos , refEnd ) ) {
3601+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename ) ) ;
3602+ }
35983603 }
3599- else if ( ! findSourceFile ( filename , isDefaultLib , refFile , refPos , refEnd ) ) {
3600- errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename ) ) ;
3604+ else {
3605+ if ( ! ( findSourceFile ( filename + ".ts" , isDefaultLib , refFile , refPos , refEnd ) || findSourceFile ( filename + ".d.ts" , isDefaultLib , refFile , refPos , refEnd ) ) ) {
3606+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename + ".ts" ) ) ;
3607+ }
36013608 }
36023609 }
36033610
0 commit comments