@@ -878,8 +878,8 @@ export class Compiler extends DiagnosticEmitter {
878878 // Importing mutable globals is not supported in the MVP
879879 } else {
880880 this . error (
881- DiagnosticCode . Operation_not_supported ,
882- global . declaration . range
881+ DiagnosticCode . Feature_0_is_not_enabled ,
882+ global . declaration . range , "mutable-globals"
883883 ) ;
884884 }
885885 return false ;
@@ -1258,8 +1258,8 @@ export class Compiler extends DiagnosticEmitter {
12581258 let decoratorNodes = instance . decoratorNodes ;
12591259 let decorator = assert ( findDecorator ( DecoratorKind . EXTERNAL , decoratorNodes ) ) ;
12601260 this . error (
1261- DiagnosticCode . Operation_not_supported ,
1262- decorator . range
1261+ DiagnosticCode . Decorator_0_is_not_valid_here ,
1262+ decorator . range , "external"
12631263 ) ;
12641264 }
12651265
@@ -1447,7 +1447,7 @@ export class Compiler extends DiagnosticEmitter {
14471447 ) : void {
14481448 // TODO
14491449 this . error (
1450- DiagnosticCode . Operation_not_supported ,
1450+ DiagnosticCode . Not_implemented ,
14511451 declaration . range
14521452 ) ;
14531453 }
@@ -1765,7 +1765,7 @@ export class Compiler extends DiagnosticEmitter {
17651765 case NodeKind . TYPEDECLARATION : {
17661766 // TODO: integrate inner type declaration into flow
17671767 this . error (
1768- DiagnosticCode . Operation_not_supported ,
1768+ DiagnosticCode . Not_implemented ,
17691769 statement . range
17701770 ) ;
17711771 stmt = module . unreachable ( ) ;
@@ -1835,7 +1835,7 @@ export class Compiler extends DiagnosticEmitter {
18351835 var module = this . module ;
18361836 if ( statement . label ) {
18371837 this . error (
1838- DiagnosticCode . Operation_not_supported ,
1838+ DiagnosticCode . Not_implemented ,
18391839 statement . label . range
18401840 ) ;
18411841 return module . unreachable ( ) ;
@@ -1869,7 +1869,7 @@ export class Compiler extends DiagnosticEmitter {
18691869 var label = statement . label ;
18701870 if ( label ) {
18711871 this . error (
1872- DiagnosticCode . Operation_not_supported ,
1872+ DiagnosticCode . Not_implemented ,
18731873 label . range
18741874 ) ;
18751875 return module . unreachable ( ) ;
@@ -2415,7 +2415,7 @@ export class Compiler extends DiagnosticEmitter {
24152415 // TODO: can't yet support something like: try { return ... } finally { ... }
24162416 // worthwhile to investigate lowering returns to block results (here)?
24172417 this . error (
2418- DiagnosticCode . Operation_not_supported ,
2418+ DiagnosticCode . Not_implemented ,
24192419 statement . range
24202420 ) ;
24212421 return this . module . unreachable ( ) ;
@@ -2859,7 +2859,7 @@ export class Compiler extends DiagnosticEmitter {
28592859 }
28602860 default : {
28612861 this . error (
2862- DiagnosticCode . Operation_not_supported ,
2862+ DiagnosticCode . Not_implemented ,
28632863 expression . range
28642864 ) ;
28652865 expr = this . module . unreachable ( ) ;
@@ -3651,7 +3651,7 @@ export class Compiler extends DiagnosticEmitter {
36513651 case TypeKind . ANYREF : {
36523652 // TODO: ref.eq
36533653 this . error (
3654- DiagnosticCode . Operation_not_supported ,
3654+ DiagnosticCode . Not_implemented ,
36553655 expression . range
36563656 ) ;
36573657 expr = module . unreachable ( ) ;
@@ -3748,7 +3748,7 @@ export class Compiler extends DiagnosticEmitter {
37483748 case TypeKind . ANYREF : {
37493749 // TODO: !ref.eq
37503750 this . error (
3751- DiagnosticCode . Operation_not_supported ,
3751+ DiagnosticCode . Not_implemented ,
37523752 expression . range
37533753 ) ;
37543754 expr = module . unreachable ( ) ;
@@ -5250,7 +5250,7 @@ export class Compiler extends DiagnosticEmitter {
52505250 }
52515251 default : {
52525252 this . error (
5253- DiagnosticCode . Operation_not_supported ,
5253+ DiagnosticCode . Not_implemented ,
52545254 expression . range
52555255 ) ;
52565256 return this . module . unreachable ( ) ;
@@ -5445,7 +5445,7 @@ export class Compiler extends DiagnosticEmitter {
54455445 }
54465446 }
54475447 this . error (
5448- DiagnosticCode . Operation_not_supported ,
5448+ DiagnosticCode . Not_implemented ,
54495449 valueExpression . range
54505450 ) ;
54515451 return module . unreachable ( ) ;
@@ -5999,10 +5999,18 @@ export class Compiler extends DiagnosticEmitter {
59995999
60006000 // not supported
60016001 default : {
6002- this . error (
6003- DiagnosticCode . Operation_not_supported ,
6004- expression . range
6005- ) ;
6002+ let type = this . resolver . getTypeOfElement ( target ) ;
6003+ if ( type ) {
6004+ this . error (
6005+ DiagnosticCode . Type_0_has_no_call_signatures ,
6006+ expression . range , type . toString ( )
6007+ ) ;
6008+ } else {
6009+ this . error (
6010+ DiagnosticCode . Expression_cannot_be_represented_by_a_type ,
6011+ expression . range
6012+ ) ;
6013+ }
60066014 return module . unreachable ( ) ;
60076015 }
60086016 }
@@ -6046,22 +6054,14 @@ export class Compiler extends DiagnosticEmitter {
60466054 }
60476055
60486056 // now compile the builtin, which usually returns a block of code that replaces the call.
6049- var expr = compileBuiltinCall (
6057+ return compileBuiltinCall (
60506058 this ,
60516059 prototype ,
60526060 typeArguments ,
60536061 expression . arguments ,
60546062 contextualType ,
60556063 expression
60566064 ) ;
6057- if ( ! expr ) {
6058- this . error (
6059- DiagnosticCode . Operation_not_supported ,
6060- expression . range
6061- ) ;
6062- return this . module . unreachable ( ) ;
6063- }
6064- return expr ;
60656065 }
60666066
60676067 /**
@@ -6079,7 +6079,7 @@ export class Compiler extends DiagnosticEmitter {
60796079 var thisType = signature . thisType ;
60806080 if ( hasThis != ( thisType != null ) ) {
60816081 this . error (
6082- DiagnosticCode . Operation_not_supported , // TODO: better message?
6082+ DiagnosticCode . The_this_types_of_each_signature_are_incompatible ,
60836083 reportNode . range
60846084 ) ;
60856085 return false ;
@@ -6089,7 +6089,7 @@ export class Compiler extends DiagnosticEmitter {
60896089 var hasRest = signature . hasRest ;
60906090 if ( hasRest ) {
60916091 this . error (
6092- DiagnosticCode . Operation_not_supported ,
6092+ DiagnosticCode . Not_implemented ,
60936093 reportNode . range
60946094 ) ;
60956095 return false ;
@@ -6126,7 +6126,7 @@ export class Compiler extends DiagnosticEmitter {
61266126 // Library files may always use unsafe features
61276127 if ( this . options . noUnsafe && ! reportNode . range . source . isLibrary ) {
61286128 this . error (
6129- DiagnosticCode . Expression_is_unsafe ,
6129+ DiagnosticCode . Operation_is_unsafe ,
61306130 reportNode . range
61316131 ) ;
61326132 }
@@ -7312,7 +7312,7 @@ export class Compiler extends DiagnosticEmitter {
73127312 }
73137313 }
73147314 this . error (
7315- DiagnosticCode . Operation_not_supported ,
7315+ DiagnosticCode . Not_implemented ,
73167316 expression . range
73177317 ) ;
73187318 return this . module . unreachable ( ) ;
@@ -7390,8 +7390,8 @@ export class Compiler extends DiagnosticEmitter {
73907390 ) ;
73917391 } else {
73927392 this . error (
7393- DiagnosticCode . Operation_not_supported ,
7394- expression . range
7393+ DiagnosticCode . Operator_0_cannot_be_applied_to_types_1_and_2 ,
7394+ expression . range , "instanceof" , actualType . toString ( ) , expectedType . toString ( )
73957395 ) ;
73967396 }
73977397 }
@@ -7432,8 +7432,8 @@ export class Compiler extends DiagnosticEmitter {
74327432 ) ;
74337433 } else {
74347434 this . error (
7435- DiagnosticCode . Operation_not_supported ,
7436- expression . range
7435+ DiagnosticCode . Operator_0_cannot_be_applied_to_types_1_and_2 ,
7436+ expression . range , "instanceof" , actualType . toString ( ) , expectedType . toString ( )
74377437 ) ;
74387438 }
74397439 }
@@ -7468,8 +7468,8 @@ export class Compiler extends DiagnosticEmitter {
74687468 }
74697469 }
74707470 this . error (
7471- DiagnosticCode . Operation_not_supported ,
7472- expression . range
7471+ DiagnosticCode . The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly ,
7472+ expression . range , "T"
74737473 ) ;
74747474 return module . unreachable ( ) ;
74757475 }
@@ -7515,7 +7515,7 @@ export class Compiler extends DiagnosticEmitter {
75157515 // case LiteralKind.REGEXP:
75167516 }
75177517 this . error (
7518- DiagnosticCode . Operation_not_supported ,
7518+ DiagnosticCode . Not_implemented ,
75197519 expression . range
75207520 ) ;
75217521 this . currentType = contextualType ;
@@ -7777,7 +7777,7 @@ export class Compiler extends DiagnosticEmitter {
77777777 if ( ! target ) return module . unreachable ( ) ;
77787778 if ( target . kind != ElementKind . CLASS_PROTOTYPE ) {
77797779 this . error (
7780- DiagnosticCode . Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature ,
7780+ DiagnosticCode . This_expression_is_not_constructable ,
77817781 expression . expression . range
77827782 ) ;
77837783 return this . module . unreachable ( ) ;
@@ -8038,7 +8038,7 @@ export class Compiler extends DiagnosticEmitter {
80388038 }
80398039 }
80408040 this . error (
8041- DiagnosticCode . Operation_not_supported ,
8041+ DiagnosticCode . Not_implemented ,
80428042 expression . range
80438043 ) ;
80448044 return module . unreachable ( ) ;
@@ -8190,8 +8190,8 @@ export class Compiler extends DiagnosticEmitter {
81908190 }
81918191 }
81928192 this . error (
8193- DiagnosticCode . Operation_not_supported ,
8194- expression . range
8193+ DiagnosticCode . The_0_operator_cannot_be_applied_to_type_1 ,
8194+ expression . range , "++" , this . currentType . toString ( )
81958195 ) ;
81968196 if ( tempLocal ) flow . freeTempLocal ( tempLocal ) ;
81978197 return module . unreachable ( ) ;
@@ -8279,8 +8279,8 @@ export class Compiler extends DiagnosticEmitter {
82798279 }
82808280 }
82818281 this . error (
8282- DiagnosticCode . Operation_not_supported ,
8283- expression . range
8282+ DiagnosticCode . The_0_operator_cannot_be_applied_to_type_1 ,
8283+ expression . range , "--" , this . currentType . toString ( )
82848284 ) ;
82858285 if ( tempLocal ) flow . freeTempLocal ( tempLocal ) ;
82868286 return module . unreachable ( ) ;
0 commit comments