File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -9044,10 +9044,29 @@ export class Compiler extends DiagnosticEmitter {
90449044 }
90459045 case ElementKind . FunctionPrototype : {
90469046 let functionPrototype = < FunctionPrototype > target ;
9047+ let typeParameterNodes = functionPrototype . typeParameterNodes ;
9048+
9049+ if ( typeParameterNodes && typeParameterNodes . length != 0 ) {
9050+ this . error (
9051+ DiagnosticCode . Type_argument_expected ,
9052+ expression . range
9053+ ) ;
9054+ break ; // also diagnose 'not a value at runtime'
9055+ }
9056+
90479057 let functionInstance = this . resolver . resolveFunction ( functionPrototype , null ) ;
90489058 if ( ! functionInstance ) return module . unreachable ( ) ;
90499059 if ( ! this . compileFunction ( functionInstance ) ) return module . unreachable ( ) ;
90509060 this . currentType = functionInstance . type ;
9061+
9062+ if ( functionInstance . hasDecorator ( DecoratorFlags . Builtin ) ) {
9063+ this . error (
9064+ DiagnosticCode . Not_implemented_0 ,
9065+ expression . range , "First-class built-ins"
9066+ ) ;
9067+ return module . unreachable ( ) ;
9068+ }
9069+
90519070 let offset = this . ensureRuntimeFunction ( functionInstance ) ;
90529071 return this . options . isWasm64
90539072 ? module . i64 ( i64_low ( offset ) , i64_high ( offset ) )
Original file line number Diff line number Diff line change 1+ {
2+ "stderr" : [
3+ " TS1140: Type argument expected." ,
4+ " foo.bar;" ,
5+ " AS234: Expression does not compile to a value at runtime." ,
6+ " foo.bar;" ,
7+ " TS1140: Type argument expected." ,
8+ " memory.data;" ,
9+ " AS234: Expression does not compile to a value at runtime." ,
10+ " memory.data;" ,
11+ " AS100: Not implemented: First-class built-ins" ,
12+ " atomic.fence;" ,
13+ " EOF"
14+ ]
15+ }
Original file line number Diff line number Diff line change 1+ namespace foo {
2+ export function bar < T > ( ) : void { }
3+ }
4+
5+ // Should error from missing type arguments:
6+ foo . bar ;
7+ memory . data ;
8+
9+ // Should error from lacking first-class builtins:
10+ atomic . fence ;
11+
12+ ERROR ( "EOF" ) ;
You can’t perform that action at this time.
0 commit comments