File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ describe('Schema Parser', () => {
333
333
world: String
334
334
}
335
335
` ) . to . deep . equal ( {
336
- message : 'Syntax Error: Unexpected Name "extend".' ,
336
+ message : 'Syntax Error: Unexpected Name "extend". Extension do not include descriptions. ' ,
337
337
locations : [ { line : 3 , column : 7 } ] ,
338
338
} ) ;
339
339
@@ -354,7 +354,7 @@ describe('Schema Parser', () => {
354
354
world: String
355
355
}
356
356
` ) . to . deep . equal ( {
357
- message : 'Syntax Error: Unexpected Name "extend".' ,
357
+ message : 'Syntax Error: Unexpected Name "extend". Extension do not include descriptions. ' ,
358
358
locations : [ { line : 3 , column : 7 } ] ,
359
359
} ) ;
360
360
Original file line number Diff line number Diff line change @@ -725,7 +725,8 @@ class Parser {
725
725
*/
726
726
parseTypeSystemDefinition ( ) : TypeSystemDefinitionNode {
727
727
// Many definitions begin with a description and require a lookahead.
728
- const keywordToken = this . peekDescription ( )
728
+ const hasDescription = this . peekDescription ( ) ;
729
+ const keywordToken = hasDescription
729
730
? this . _lexer . lookahead ( )
730
731
: this . _lexer . token ;
731
732
@@ -750,6 +751,14 @@ class Parser {
750
751
}
751
752
}
752
753
754
+ if ( hasDescription && keywordToken . value === 'extend' ) {
755
+ throw syntaxError (
756
+ this . _lexer . source ,
757
+ keywordToken . start ,
758
+ 'Unexpected Name "extend". Extension do not include descriptions.' ,
759
+ ) ;
760
+ }
761
+
753
762
throw this . unexpected ( keywordToken ) ;
754
763
}
755
764
You can’t perform that action at this time.
0 commit comments