From b97356787bd9175cd329db5f43747a398cebc240 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Thu, 2 Dec 2021 10:59:41 +0000 Subject: [PATCH] Change out varlist to GenericTypeList The original definition is wrong, since generic lists can also have generic type packs (...) --- docs/_pages/grammar.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/_pages/grammar.md b/docs/_pages/grammar.md index 8e7402a5..670a6493 100644 --- a/docs/_pages/grammar.md +++ b/docs/_pages/grammar.md @@ -19,7 +19,7 @@ stat ::= varlist `=' explist | function funcname funcbody | local function Name funcbody | local namelist [`=' explist] | - [export] type Name [`<' varlist `>'] `=' typeannotation + [export] type Name [`<' GenericTypeList `>'] `=' typeannotation laststat ::= return [explist] | break | continue @@ -52,8 +52,9 @@ typeannotation ::= `(' [TypeList] `)' `->` ReturnType `typeof` typeannotation -typeannotation ::= nil | Name[`.' Name] [ `<' typeannotation [`,' ...] `>' ] | `typeof' `(' expr `)' | `{' [PropList] `}' | [`<' varlist `>'] `(' [TypeList] `)' `->` ReturnType +typeannotation ::= nil | Name[`.' Name] [ `<' typeannotation [`,' ...] `>' ] | `typeof' `(' expr `)' | `{' [PropList] `}' | [`<' GenericTypeList `>'] `(' [TypeList] `)' `->` ReturnType +GenericTypeList ::= NAME [`...'] {`,' NAME} TypeList ::= TypeAnnotation [`,' TypeList] | ...TypeAnnotation ReturnType ::= TypeAnnotation | `(' TypeList `)' TableIndexer ::= `[' TypeAnnotation `]' `:' TypeAnnotation @@ -61,6 +62,6 @@ TableProp ::= Name `:' TypeAnnotation TablePropOrIndexer ::= TableProp | TableIndexer PropList ::= TablePropOrIndexer {fieldsep TablePropOrIndexer} [fieldsep] TableTypeAnnotation ::= `{' PropList `}' -FunctionTypeAnnotation ::= [`<' varlist `>'] `(' [TypeList] `)' `->` ReturnType +FunctionTypeAnnotation ::= [`<' GenericTypeList `>'] `(' [TypeList] `)' `->` ReturnType ```