From 439406e981ae9003f576e10133efb473a1c972c8 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 09:25:54 +0200 Subject: [PATCH 01/16] feat: add list & map literals to grammar --- src/language/grammar/safe-ds.langium | 45 +++++++++++++++---- .../lists/bad-unclosed square bracket.sdstest | 5 +++ .../good-nested multiple elements.sdstest | 5 +++ .../lists/good-nested one element.sdstest | 5 +++ .../good-one level multiple elements.sdstest | 5 +++ .../lists/good-one level one element.sdstest | 5 +++ .../expressions/maps/bad-no colon.sdstest | 5 +++ .../expressions/maps/bad-no key.sdstest | 5 +++ .../expressions/maps/bad-no value.sdstest | 5 +++ .../maps/bad-unclosed curly brace.sdstest | 5 +++ .../good-nested multiple elements.sdstest | 10 +++++ .../maps/good-nested one element.sdstest | 9 ++++ .../good-one level multiple elements.sdstest | 5 +++ .../maps/good-one level one element.sdstest | 5 +++ .../grammar/trailing commas/good-list.sdstest | 5 +++ .../grammar/trailing commas/good-map.sdstest | 5 +++ 16 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 tests/resources/grammar/expressions/lists/bad-unclosed square bracket.sdstest create mode 100644 tests/resources/grammar/expressions/lists/good-nested multiple elements.sdstest create mode 100644 tests/resources/grammar/expressions/lists/good-nested one element.sdstest create mode 100644 tests/resources/grammar/expressions/lists/good-one level multiple elements.sdstest create mode 100644 tests/resources/grammar/expressions/lists/good-one level one element.sdstest create mode 100644 tests/resources/grammar/expressions/maps/bad-no colon.sdstest create mode 100644 tests/resources/grammar/expressions/maps/bad-no key.sdstest create mode 100644 tests/resources/grammar/expressions/maps/bad-no value.sdstest create mode 100644 tests/resources/grammar/expressions/maps/bad-unclosed curly brace.sdstest create mode 100644 tests/resources/grammar/expressions/maps/good-nested multiple elements.sdstest create mode 100644 tests/resources/grammar/expressions/maps/good-nested one element.sdstest create mode 100644 tests/resources/grammar/expressions/maps/good-one level multiple elements.sdstest create mode 100644 tests/resources/grammar/expressions/maps/good-one level one element.sdstest create mode 100644 tests/resources/grammar/trailing commas/good-list.sdstest create mode 100644 tests/resources/grammar/trailing commas/good-map.sdstest diff --git a/src/language/grammar/safe-ds.langium b/src/language/grammar/safe-ds.langium index 6806c5f2b..85c85f5c9 100644 --- a/src/language/grammar/safe-ds.langium +++ b/src/language/grammar/safe-ds.langium @@ -342,7 +342,7 @@ SdsAnnotationCall returns SdsAnnotationCall: ; SdsAnnotationCallArgumentList returns SdsArgumentList: - {SdsArgumentList} '(' (arguments+=SdsAnnotationCallArgument (',' arguments+=SdsAnnotationCallArgument )* ','? )? ')' + {SdsArgumentList} '(' (arguments+=SdsAnnotationCallArgument (',' arguments+=SdsAnnotationCallArgument)* ','? )? ')' ; SdsAnnotationCallArgument returns SdsArgument: @@ -484,7 +484,7 @@ interface SdsAssigneeList extends SdsObject { } SdsAssigneeList returns SdsAssigneeList: - assignees+=SdsAssignee (',' assignees+=SdsAssignee )* ','? + assignees+=SdsAssignee (',' assignees+=SdsAssignee)* ','? ; interface SdsAssignee extends SdsObject {} @@ -553,7 +553,7 @@ SdsBlockLambdaAssignment returns SdsAssignment: ; SdsBlockLambdaAssigneeList returns SdsAssigneeList: - assignees+=SdsBlockLambdaAssignee (',' assignees+=SdsBlockLambdaAssignee )* ','? + assignees+=SdsBlockLambdaAssignee (',' assignees+=SdsBlockLambdaAssignee)* ','? ; interface SdsBlockLambdaResult extends SdsAssignee, SdsAbstractResult {} @@ -720,12 +720,22 @@ SdsCallArgument returns SdsArgument: ; SdsPrimaryExpression returns SdsExpression: - SdsLiteral + SdsList + | SdsLiteral + | SdsMap | SdsParenthesizedExpression | SdsReference | SdsTemplateString ; +interface SdsList extends SdsExpression { + elements: SdsExpression[] +} + +SdsList returns SdsList: + {SdsList} '[' (elements+=SdsExpression (',' elements+=SdsExpression)* ','? )? ']' +; + interface SdsLiteral extends SdsExpression {} SdsLiteral returns SdsLiteral: @@ -777,12 +787,21 @@ SdsString returns SdsString: value=STRING ; -interface SdsReference extends SdsExpression { - target: @SdsDeclaration +interface SdsMap extends SdsExpression { + entries: SdsMapEntry[] } -SdsReference returns SdsReference: - target=[SdsDeclaration:ID] +SdsMap returns SdsMap: + {SdsMap} '{' (entries+=SdsMapEntry (',' entries+=SdsMapEntry)* ','? )? '}' +; + +interface SdsMapEntry extends SdsObject { + key: SdsExpression + value: SdsExpression +} + +SdsMapEntry returns SdsMapEntry: + key=SdsExpression ':' value=SdsExpression ; interface SdsParenthesizedExpression extends SdsExpression { @@ -793,6 +812,14 @@ SdsParenthesizedExpression returns SdsParenthesizedExpression: '(' expression=SdsExpression ')' ; +interface SdsReference extends SdsExpression { + target: @SdsDeclaration +} + +SdsReference returns SdsReference: + target=[SdsDeclaration:ID] +; + interface SdsTemplateString extends SdsExpression { expressions: SdsExpression[] } @@ -1009,7 +1036,7 @@ interface SdsColumnList extends SdsObject { } SdsColumnList returns SdsColumnList: - {SdsColumnList} '{' (columns+=SdsColumn (',' columns+=SdsColumn )* ','? )? '}' + {SdsColumnList} '{' (columns+=SdsColumn (',' columns+=SdsColumn)* ','? )? '}' ; interface SdsColumn extends SdsObject { diff --git a/tests/resources/grammar/expressions/lists/bad-unclosed square bracket.sdstest b/tests/resources/grammar/expressions/lists/bad-unclosed square bracket.sdstest new file mode 100644 index 000000000..2a9916683 --- /dev/null +++ b/tests/resources/grammar/expressions/lists/bad-unclosed square bracket.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + [1; +} diff --git a/tests/resources/grammar/expressions/lists/good-nested multiple elements.sdstest b/tests/resources/grammar/expressions/lists/good-nested multiple elements.sdstest new file mode 100644 index 000000000..0676978cb --- /dev/null +++ b/tests/resources/grammar/expressions/lists/good-nested multiple elements.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [[1, 2]]; +} diff --git a/tests/resources/grammar/expressions/lists/good-nested one element.sdstest b/tests/resources/grammar/expressions/lists/good-nested one element.sdstest new file mode 100644 index 000000000..9edb2c2ff --- /dev/null +++ b/tests/resources/grammar/expressions/lists/good-nested one element.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [[1 + 2]]; +} diff --git a/tests/resources/grammar/expressions/lists/good-one level multiple elements.sdstest b/tests/resources/grammar/expressions/lists/good-one level multiple elements.sdstest new file mode 100644 index 000000000..5327782b2 --- /dev/null +++ b/tests/resources/grammar/expressions/lists/good-one level multiple elements.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [1, 2]; +} diff --git a/tests/resources/grammar/expressions/lists/good-one level one element.sdstest b/tests/resources/grammar/expressions/lists/good-one level one element.sdstest new file mode 100644 index 000000000..2f0593a4b --- /dev/null +++ b/tests/resources/grammar/expressions/lists/good-one level one element.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [1 + 2]; +} diff --git a/tests/resources/grammar/expressions/maps/bad-no colon.sdstest b/tests/resources/grammar/expressions/maps/bad-no colon.sdstest new file mode 100644 index 000000000..62ec6038a --- /dev/null +++ b/tests/resources/grammar/expressions/maps/bad-no colon.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + {1 "one"}; +} diff --git a/tests/resources/grammar/expressions/maps/bad-no key.sdstest b/tests/resources/grammar/expressions/maps/bad-no key.sdstest new file mode 100644 index 000000000..74ffc56ef --- /dev/null +++ b/tests/resources/grammar/expressions/maps/bad-no key.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + {: "one"}; +} diff --git a/tests/resources/grammar/expressions/maps/bad-no value.sdstest b/tests/resources/grammar/expressions/maps/bad-no value.sdstest new file mode 100644 index 000000000..3b6dbb198 --- /dev/null +++ b/tests/resources/grammar/expressions/maps/bad-no value.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + {1: }; +} diff --git a/tests/resources/grammar/expressions/maps/bad-unclosed curly brace.sdstest b/tests/resources/grammar/expressions/maps/bad-unclosed curly brace.sdstest new file mode 100644 index 000000000..d87b4d945 --- /dev/null +++ b/tests/resources/grammar/expressions/maps/bad-unclosed curly brace.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + {1: "one"; +} diff --git a/tests/resources/grammar/expressions/maps/good-nested multiple elements.sdstest b/tests/resources/grammar/expressions/maps/good-nested multiple elements.sdstest new file mode 100644 index 000000000..e53c86eb4 --- /dev/null +++ b/tests/resources/grammar/expressions/maps/good-nested multiple elements.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + { + 1: { + 2: "three", + 4: "five" + } + }; +} diff --git a/tests/resources/grammar/expressions/maps/good-nested one element.sdstest b/tests/resources/grammar/expressions/maps/good-nested one element.sdstest new file mode 100644 index 000000000..81c263733 --- /dev/null +++ b/tests/resources/grammar/expressions/maps/good-nested one element.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + { + 1: { + 2: "three" + } + }; +} diff --git a/tests/resources/grammar/expressions/maps/good-one level multiple elements.sdstest b/tests/resources/grammar/expressions/maps/good-one level multiple elements.sdstest new file mode 100644 index 000000000..cb179d9b4 --- /dev/null +++ b/tests/resources/grammar/expressions/maps/good-one level multiple elements.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + {1: "one", 2: "two"}; +} diff --git a/tests/resources/grammar/expressions/maps/good-one level one element.sdstest b/tests/resources/grammar/expressions/maps/good-one level one element.sdstest new file mode 100644 index 000000000..32922ba0d --- /dev/null +++ b/tests/resources/grammar/expressions/maps/good-one level one element.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + {1: "one"}; +} diff --git a/tests/resources/grammar/trailing commas/good-list.sdstest b/tests/resources/grammar/trailing commas/good-list.sdstest new file mode 100644 index 000000000..be2054ad7 --- /dev/null +++ b/tests/resources/grammar/trailing commas/good-list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [1, 2, ]; +} diff --git a/tests/resources/grammar/trailing commas/good-map.sdstest b/tests/resources/grammar/trailing commas/good-map.sdstest new file mode 100644 index 000000000..787c00d77 --- /dev/null +++ b/tests/resources/grammar/trailing commas/good-map.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + {1: "one", 2: "two", }; +} From 2756df5506e43a4d52e4de04c00849093c6ad229 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 10:01:19 +0200 Subject: [PATCH 02/16] test: formatter --- tests/language/formatting/creator.ts | 18 +++++++++--------- .../lists/nested multiple elements.sdstest | 11 +++++++++++ .../lists/nested one element.sdstest | 11 +++++++++++ .../lists/one level multiple elements.sdstest | 9 +++++++++ .../lists/one level one element.sdstest | 9 +++++++++ .../maps/good-nested multiple elements.sdstest | 15 +++++++++++++++ .../maps/good-nested one element.sdstest | 13 +++++++++++++ .../good-one level multiple elements.sdstest | 12 ++++++++++++ .../maps/good-one level one element.sdstest | 9 +++++++++ .../elements of list (complex).sdstest | 12 ++++++++++++ .../trailing commas/elements of list.sdstest | 9 +++++++++ .../entries of map (complex).sdstest | 11 +++++++++++ .../entries of map (multiple entries).sdstest | 12 ++++++++++++ .../entries of map (one literal entry).sdstest | 9 +++++++++ .../good-elements of list.sdstest | 5 +++++ .../good-entries of map.sdstest | 5 +++++ 16 files changed, 161 insertions(+), 9 deletions(-) create mode 100644 tests/resources/formatting/expressions/lists/nested multiple elements.sdstest create mode 100644 tests/resources/formatting/expressions/lists/nested one element.sdstest create mode 100644 tests/resources/formatting/expressions/lists/one level multiple elements.sdstest create mode 100644 tests/resources/formatting/expressions/lists/one level one element.sdstest create mode 100644 tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest create mode 100644 tests/resources/formatting/expressions/maps/good-nested one element.sdstest create mode 100644 tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest create mode 100644 tests/resources/formatting/expressions/maps/good-one level one element.sdstest create mode 100644 tests/resources/formatting/trailing commas/elements of list (complex).sdstest create mode 100644 tests/resources/formatting/trailing commas/elements of list.sdstest create mode 100644 tests/resources/formatting/trailing commas/entries of map (complex).sdstest create mode 100644 tests/resources/formatting/trailing commas/entries of map (multiple entries).sdstest create mode 100644 tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest create mode 100644 tests/resources/grammar/trailing commas/good-elements of list.sdstest create mode 100644 tests/resources/grammar/trailing commas/good-entries of map.sdstest diff --git a/tests/language/formatting/creator.ts b/tests/language/formatting/creator.ts index 4d1f6e380..33e02ed3e 100644 --- a/tests/language/formatting/creator.ts +++ b/tests/language/formatting/creator.ts @@ -21,7 +21,7 @@ const createFormattingTest = async (uri: URI): Promise => { // Must contain exactly one separator if (parts.length !== 2) { - return invalidTest(uri, new SeparatorError(parts.length - 1)); + return invalidTest(uri, new SeparatorError(uri, parts.length - 1)); } const originalCode = normalizeLineBreaks(parts[0]).trimEnd(); @@ -30,13 +30,13 @@ const createFormattingTest = async (uri: URI): Promise => { // Original code must not contain syntax errors const syntaxErrorsInOriginalCode = await getSyntaxErrors(services, originalCode); if (syntaxErrorsInOriginalCode.length > 0) { - return invalidTest(uri, new SyntaxErrorsInOriginalCodeError(syntaxErrorsInOriginalCode)); + return invalidTest(uri, new SyntaxErrorsInOriginalCodeError(uri, syntaxErrorsInOriginalCode)); } // Expected formatted code must not contain syntax errors const syntaxErrorsInExpectedFormattedCode = await getSyntaxErrors(services, expectedFormattedCode); if (syntaxErrorsInExpectedFormattedCode.length > 0) { - return invalidTest(uri, new SyntaxErrorsInExpectedFormattedCodeError(syntaxErrorsInExpectedFormattedCode)); + return invalidTest(uri, new SyntaxErrorsInExpectedFormattedCodeError(uri, syntaxErrorsInExpectedFormattedCode)); } const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); @@ -99,8 +99,8 @@ interface FormattingTest extends TestDescription { * The file contains no or more than one separator. */ class SeparatorError extends Error { - constructor(readonly number_of_separators: number) { - super(`Expected exactly one separator but found ${number_of_separators}.`); + constructor(readonly uri: URI, readonly number_of_separators: number) { + super(`Expected exactly one separator in ${uri.toString()} but found ${number_of_separators}.`); } } @@ -108,10 +108,10 @@ class SeparatorError extends Error { * The original code contains syntax errors. */ class SyntaxErrorsInOriginalCodeError extends Error { - constructor(readonly syntaxErrors: Diagnostic[]) { + constructor(readonly uri: URI, readonly syntaxErrors: Diagnostic[]) { const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); - super(`Original code has syntax errors:\n${syntaxErrorsAsString}`); + super(`Original code in ${uri.toString()} has syntax errors:\n${syntaxErrorsAsString}`); } } @@ -119,9 +119,9 @@ class SyntaxErrorsInOriginalCodeError extends Error { * The expected formatted code contains syntax errors. */ class SyntaxErrorsInExpectedFormattedCodeError extends Error { - constructor(readonly syntaxErrors: Diagnostic[]) { + constructor(readonly uri: URI, readonly syntaxErrors: Diagnostic[]) { const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); - super(`Expected formatted code has syntax errors:\n${syntaxErrorsAsString}`); + super(`Expected formatted code in ${uri.toString()} has syntax errors:\n${syntaxErrorsAsString}`); } } diff --git a/tests/resources/formatting/expressions/lists/nested multiple elements.sdstest b/tests/resources/formatting/expressions/lists/nested multiple elements.sdstest new file mode 100644 index 000000000..c7bb5e171 --- /dev/null +++ b/tests/resources/formatting/expressions/lists/nested multiple elements.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + [ [ 1 , 2 ] ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [ + [1, 2] + ]; +} diff --git a/tests/resources/formatting/expressions/lists/nested one element.sdstest b/tests/resources/formatting/expressions/lists/nested one element.sdstest new file mode 100644 index 000000000..109b9e561 --- /dev/null +++ b/tests/resources/formatting/expressions/lists/nested one element.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + [ [ 1 + 2 ] ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [ + [1 + 2] + ]; +} diff --git a/tests/resources/formatting/expressions/lists/one level multiple elements.sdstest b/tests/resources/formatting/expressions/lists/one level multiple elements.sdstest new file mode 100644 index 000000000..d389dcd65 --- /dev/null +++ b/tests/resources/formatting/expressions/lists/one level multiple elements.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + [ 1 , 2 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [1, 2]; +} diff --git a/tests/resources/formatting/expressions/lists/one level one element.sdstest b/tests/resources/formatting/expressions/lists/one level one element.sdstest new file mode 100644 index 000000000..9efcff74c --- /dev/null +++ b/tests/resources/formatting/expressions/lists/one level one element.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + [ 1 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [1]; +} diff --git a/tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest b/tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest new file mode 100644 index 000000000..01597436a --- /dev/null +++ b/tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + { 1 : { 2 : "three" , 4 : "five" } }; +} + + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: { + 2: "three", + 4: "five" + } + }; +} diff --git a/tests/resources/formatting/expressions/maps/good-nested one element.sdstest b/tests/resources/formatting/expressions/maps/good-nested one element.sdstest new file mode 100644 index 000000000..07f7e1dab --- /dev/null +++ b/tests/resources/formatting/expressions/maps/good-nested one element.sdstest @@ -0,0 +1,13 @@ +pipeline myPipeline { + { 1 : { 2 : "three" } }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: { + 2: "three" + } + }; +} diff --git a/tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest b/tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest new file mode 100644 index 000000000..bb90ecbd5 --- /dev/null +++ b/tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest @@ -0,0 +1,12 @@ +pipeline myPipeline { + { 1 : "one" , 2 : "two" }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: "one", + 2: "two" + }; +} diff --git a/tests/resources/formatting/expressions/maps/good-one level one element.sdstest b/tests/resources/formatting/expressions/maps/good-one level one element.sdstest new file mode 100644 index 000000000..98656664c --- /dev/null +++ b/tests/resources/formatting/expressions/maps/good-one level one element.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + { 1 : "one" }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + {1: "one"}; +} diff --git a/tests/resources/formatting/trailing commas/elements of list (complex).sdstest b/tests/resources/formatting/trailing commas/elements of list (complex).sdstest new file mode 100644 index 000000000..302116b57 --- /dev/null +++ b/tests/resources/formatting/trailing commas/elements of list (complex).sdstest @@ -0,0 +1,12 @@ +pipeline myPipeline { + [ 1 + 2 , 2 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [ + 1 + 2, + 2 + ]; +} diff --git a/tests/resources/formatting/trailing commas/elements of list.sdstest b/tests/resources/formatting/trailing commas/elements of list.sdstest new file mode 100644 index 000000000..d389dcd65 --- /dev/null +++ b/tests/resources/formatting/trailing commas/elements of list.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + [ 1 , 2 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [1, 2]; +} diff --git a/tests/resources/formatting/trailing commas/entries of map (complex).sdstest b/tests/resources/formatting/trailing commas/entries of map (complex).sdstest new file mode 100644 index 000000000..b639efd4b --- /dev/null +++ b/tests/resources/formatting/trailing commas/entries of map (complex).sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + { 1 : { } , }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: {}, + }; +} diff --git a/tests/resources/formatting/trailing commas/entries of map (multiple entries).sdstest b/tests/resources/formatting/trailing commas/entries of map (multiple entries).sdstest new file mode 100644 index 000000000..2bb09e059 --- /dev/null +++ b/tests/resources/formatting/trailing commas/entries of map (multiple entries).sdstest @@ -0,0 +1,12 @@ +pipeline myPipeline { + { 1 : "one" , 2 : "two" , }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: "one", + 2: "two", + }; +} diff --git a/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest b/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest new file mode 100644 index 000000000..3d45f89a4 --- /dev/null +++ b/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + { 1 : "one" , }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + {1: "one", }; +} diff --git a/tests/resources/grammar/trailing commas/good-elements of list.sdstest b/tests/resources/grammar/trailing commas/good-elements of list.sdstest new file mode 100644 index 000000000..be2054ad7 --- /dev/null +++ b/tests/resources/grammar/trailing commas/good-elements of list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + [1, 2, ]; +} diff --git a/tests/resources/grammar/trailing commas/good-entries of map.sdstest b/tests/resources/grammar/trailing commas/good-entries of map.sdstest new file mode 100644 index 000000000..787c00d77 --- /dev/null +++ b/tests/resources/grammar/trailing commas/good-entries of map.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + {1: "one", 2: "two", }; +} From 4dd45ffa8c8fa4db958e426b41ba590e0f6d8110 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 10:31:32 +0200 Subject: [PATCH 03/16] refactor: point to test file/test suite in stacktrace of errors --- tests/helpers/diagnostics.ts | 15 +++---- tests/helpers/testChecks.ts | 35 ++++++++-------- tests/helpers/testDescription.ts | 20 +++++++++- tests/helpers/testRanges.test.ts | 17 ++++---- tests/helpers/testRanges.ts | 28 ++++++++----- tests/language/formatting/creator.ts | 40 +++++++++++-------- tests/language/generation/creator.ts | 44 ++++++++++++--------- tests/language/grammar/creator.ts | 31 +++++++++------ tests/language/partialEvaluation/creator.ts | 32 +++++++++------ tests/language/scoping/creator.ts | 43 ++++++++++++-------- tests/language/typing/creator.ts | 32 +++++++++------ tests/language/validation/creator.ts | 29 +++++++------- 12 files changed, 221 insertions(+), 145 deletions(-) diff --git a/tests/helpers/diagnostics.ts b/tests/helpers/diagnostics.ts index 891aa7c32..c733726a0 100644 --- a/tests/helpers/diagnostics.ts +++ b/tests/helpers/diagnostics.ts @@ -1,6 +1,7 @@ import { parseHelper } from 'langium/test'; -import { LangiumServices } from 'langium'; +import { LangiumServices, URI } from 'langium'; import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types'; +import { TestDescriptionError } from './testDescription.js'; let nextId = 0; @@ -59,21 +60,21 @@ const getDiagnostics = async (services: LangiumServices, code: string): Promise< /** * The code contains syntax errors. */ -export class SyntaxErrorsInCodeError extends Error { - constructor(readonly syntaxErrors: Diagnostic[]) { +export class SyntaxErrorsInCodeError extends TestDescriptionError { + constructor(readonly syntaxErrors: Diagnostic[], uri: URI) { const syntaxErrorsAsString = syntaxErrors.map((e) => ` - ${e.message}`).join(`\n`); - super(`Code has syntax errors:\n${syntaxErrorsAsString}`); + super(`Code has syntax errors:\n${syntaxErrorsAsString}`, uri); } } /** * The code contains syntax errors. */ -export class ErrorsInCodeError extends Error { - constructor(readonly errors: Diagnostic[]) { +export class ErrorsInCodeError extends TestDescriptionError { + constructor(readonly errors: Diagnostic[], uri: URI) { const syntaxErrorsAsString = errors.map((e) => ` - ${e.message}`).join(`\n`); - super(`Code has errors:\n${syntaxErrorsAsString}`); + super(`Code has errors:\n${syntaxErrorsAsString}`, uri); } } diff --git a/tests/helpers/testChecks.ts b/tests/helpers/testChecks.ts index 7e5a8b76e..56711b5ec 100644 --- a/tests/helpers/testChecks.ts +++ b/tests/helpers/testChecks.ts @@ -1,8 +1,9 @@ -import { Location, Range } from 'vscode-languageserver'; -import { findTestComments } from './testComments.js'; -import { findTestRanges, FindTestRangesError } from './testRanges.js'; -import { Result } from 'true-myth'; -import { URI } from 'langium'; +import {Location, Range} from 'vscode-languageserver'; +import {findTestComments} from './testComments.js'; +import {findTestRanges, FindTestRangesError} from './testRanges.js'; +import {Result} from 'true-myth'; +import {URI} from 'langium'; +import {TestDescriptionError} from './testDescription.js'; /** * Finds all test checks, i.e. test comments and their corresponding test ranges. @@ -19,7 +20,7 @@ export const findTestChecks = ( const { failIfNoComments = false, failIfFewerRangesThanComments = false } = options; const comments = findTestComments(program); - const rangesResult = findTestRanges(program); + const rangesResult = findTestRanges(program, uri); // Opening and closing test markers must match if (rangesResult.isErr) { @@ -29,17 +30,17 @@ export const findTestChecks = ( // Must never contain more ranges than comments if (ranges.length > comments.length) { - return Result.err(new MoreRangesThanCommentsError(comments, ranges)); + return Result.err(new MoreRangesThanCommentsError(comments, ranges, uri)); } // Must contain at least one comment, if corresponding check is enabled if (failIfNoComments && comments.length === 0) { - return Result.err(new NoCommentsError()); + return Result.err(new NoCommentsError(uri)); } // Must not contain fewer ranges than comments, if corresponding check is enabled if (failIfFewerRangesThanComments && ranges.length < comments.length) { - return Result.err(new FewerRangesThanCommentsError(comments, ranges)); + return Result.err(new FewerRangesThanCommentsError(comments, ranges, uri)); } return Result.ok( @@ -87,32 +88,34 @@ export type FindTestChecksError = /** * Found more test ranges than test comments. */ -export class MoreRangesThanCommentsError extends Error { +export class MoreRangesThanCommentsError extends TestDescriptionError { constructor( readonly comments: string[], readonly ranges: Range[], + uri: URI, ) { - super(`Found more test ranges (${ranges.length}) than test comments (${comments.length}).`); + super(`Found more test ranges (${ranges.length}) than test comments (${comments.length}).`, uri); } } /** * Did not find any test comments. */ -export class NoCommentsError extends Error { - constructor() { - super('No test comments found.'); +export class NoCommentsError extends TestDescriptionError { + constructor(uri: URI) { + super('No test comments found.', uri); } } /** * Found fewer test ranges than test comments. */ -export class FewerRangesThanCommentsError extends Error { +export class FewerRangesThanCommentsError extends TestDescriptionError { constructor( readonly comments: string[], readonly ranges: Range[], + uri: URI, ) { - super(`Found fewer test ranges (${ranges.length}) than test comments (${comments.length}).`); + super(`Found fewer test ranges (${ranges.length}) than test comments (${comments.length}).`, uri); } } diff --git a/tests/helpers/testDescription.ts b/tests/helpers/testDescription.ts index 8a9620a4e..aac6a5558 100644 --- a/tests/helpers/testDescription.ts +++ b/tests/helpers/testDescription.ts @@ -1,3 +1,5 @@ +import {URI} from "langium"; + /** * A description of a test. This interface should be extended to describe tests of specific components. */ @@ -10,5 +12,21 @@ export interface TestDescription { /** * An error that occurred while creating the test. If this is undefined, the test is valid. */ - error?: Error; + error?: TestDescriptionError; +} + +/** + * An error that occurred while creating a test. + * + * @param message A message describing the error. + * @param uri The URI of the file/directory that caused the error. + */ +export class TestDescriptionError extends Error { + constructor( + message: string, + readonly uri: URI, + ) { + super(message); + this.stack = uri.toString(); + } } diff --git a/tests/helpers/testRanges.test.ts b/tests/helpers/testRanges.test.ts index 83faa6ffb..a6961e6a2 100644 --- a/tests/helpers/testRanges.test.ts +++ b/tests/helpers/testRanges.test.ts @@ -2,10 +2,13 @@ import { describe, expect, it } from 'vitest'; import { CloseWithoutOpenError, findTestRanges, OpenWithoutCloseError } from './testRanges.js'; import { Position, Range } from 'vscode-languageserver'; import { CLOSE, OPEN } from './testMarker.js'; +import { URI } from 'langium'; + +const uri = URI.file(''); describe('findTestRanges', () => { it('should find all ranges enclosed by test markers in order of opening markers', () => { - const result = findTestRanges(`text${OPEN}text${CLOSE}\n${OPEN}text${CLOSE}`); + const result = findTestRanges(`text${OPEN}text${CLOSE}\n${OPEN}text${CLOSE}`, uri); expect(result.isOk).toBeTruthy(); if (result.isOk) { @@ -15,7 +18,7 @@ describe('findTestRanges', () => { }); it('should handle nested test markers', () => { - const result = findTestRanges(`${OPEN}\n ${OPEN}${CLOSE}\n${CLOSE}`); + const result = findTestRanges(`${OPEN}\n ${OPEN}${CLOSE}\n${CLOSE}`, uri); expect(result.isOk).toBeTruthy(); if (result.isOk) { @@ -25,7 +28,7 @@ describe('findTestRanges', () => { }); it('should handle line feed (Unix)', () => { - const result = findTestRanges(`\n${OPEN}\n${CLOSE}`); + const result = findTestRanges(`\n${OPEN}\n${CLOSE}`, uri); expect(result.isOk).toBeTruthy(); if (result.isOk) { @@ -35,7 +38,7 @@ describe('findTestRanges', () => { }); it('should handle carriage return (MacOS)', () => { - const result = findTestRanges(`\r${OPEN}\r${CLOSE}`); + const result = findTestRanges(`\r${OPEN}\r${CLOSE}`, uri); expect(result.isOk).toBeTruthy(); if (result.isOk) { @@ -45,7 +48,7 @@ describe('findTestRanges', () => { }); it('should handle carriage return + line feed (Windows)', () => { - const result = findTestRanges(`\r\n${OPEN}\r\n${CLOSE}`); + const result = findTestRanges(`\r\n${OPEN}\r\n${CLOSE}`, uri); expect(result.isOk).toBeTruthy(); if (result.isOk) { @@ -55,7 +58,7 @@ describe('findTestRanges', () => { }); it('should report closing test markers without matching opening test marker', () => { - const result = findTestRanges(`${OPEN}\n${CLOSE}${CLOSE}`); + const result = findTestRanges(`${OPEN}\n${CLOSE}${CLOSE}`, uri); expect(result.isErr).toBeTruthy(); if (result.isErr) { @@ -67,7 +70,7 @@ describe('findTestRanges', () => { }); it('should report opening test markers without matching closing test marker', () => { - const result = findTestRanges(`${OPEN}\n${OPEN}${OPEN}${CLOSE}`); + const result = findTestRanges(`${OPEN}\n${OPEN}${OPEN}${CLOSE}`, uri); expect(result.isErr).toBeTruthy(); if (result.isErr) { diff --git a/tests/helpers/testRanges.ts b/tests/helpers/testRanges.ts index 4d58790d2..f6d449ab6 100644 --- a/tests/helpers/testRanges.ts +++ b/tests/helpers/testRanges.ts @@ -1,7 +1,9 @@ import { Result } from 'true-myth'; -import { Range, Position } from 'vscode-languageserver'; +import { Position, Range } from 'vscode-languageserver'; import { CLOSE, OPEN } from './testMarker.js'; import { positionToString } from './location.js'; +import { TestDescriptionError } from './testDescription.js'; +import { URI } from 'langium'; /** * Finds test ranges, i.e. parts of the program delimited by opening and closing test markers. They are sorted by the @@ -9,12 +11,13 @@ import { positionToString } from './location.js'; * Nested test markers are supported. * * @param program The program with test markers. + * @param uri The URI of the program. * @return A wrapper that indicates success of failure. * @see FindTestRangesError * @see CLOSE * @see OPEN */ -export const findTestRanges = (program: string): Result => { +export const findTestRanges = (program: string, uri: URI): Result => { let currentLine = 0; let currentColumn = 0; let previousChar: string | null = null; @@ -34,7 +37,7 @@ export const findTestRanges = (program: string): Result Position.create(position.line, position.character - 1)), + uri, ), ); } else { @@ -83,17 +87,23 @@ export type FindTestRangesError = CloseWithoutOpenError | OpenWithoutCloseError; /** * Found a closing test marker without a previous opening test marker. */ -export class CloseWithoutOpenError extends Error { - constructor(readonly position: Position) { - super(`Found '${CLOSE}' without previous '${OPEN}' at ${positionToString(position)}.`); +export class CloseWithoutOpenError extends TestDescriptionError { + constructor( + readonly position: Position, + uri: URI, + ) { + super(`Found '${CLOSE}' without previous '${OPEN}' at ${positionToString(position)}.`, uri); } } /** * Reached the end of the program but there were still unclosed opening test markers. */ -export class OpenWithoutCloseError extends Error { - constructor(readonly positions: Position[]) { - super(`Found '${OPEN}' without following '${CLOSE}' at ${positions.map(positionToString).join(', ')}.`); +export class OpenWithoutCloseError extends TestDescriptionError { + constructor( + readonly positions: Position[], + uri: URI, + ) { + super(`Found '${OPEN}' without following '${CLOSE}' at ${positions.map(positionToString).join(', ')}.`, uri); } } diff --git a/tests/language/formatting/creator.ts b/tests/language/formatting/creator.ts index 33e02ed3e..e6bbbc7e3 100644 --- a/tests/language/formatting/creator.ts +++ b/tests/language/formatting/creator.ts @@ -4,7 +4,7 @@ import { Diagnostic } from 'vscode-languageserver-types'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; import { EmptyFileSystem, URI } from 'langium'; import { getSyntaxErrors } from '../../helpers/diagnostics.js'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'formatting'; @@ -21,7 +21,7 @@ const createFormattingTest = async (uri: URI): Promise => { // Must contain exactly one separator if (parts.length !== 2) { - return invalidTest(uri, new SeparatorError(uri, parts.length - 1)); + return invalidTest(new SeparatorError(parts.length - 1, uri)); } const originalCode = normalizeLineBreaks(parts[0]).trimEnd(); @@ -30,13 +30,13 @@ const createFormattingTest = async (uri: URI): Promise => { // Original code must not contain syntax errors const syntaxErrorsInOriginalCode = await getSyntaxErrors(services, originalCode); if (syntaxErrorsInOriginalCode.length > 0) { - return invalidTest(uri, new SyntaxErrorsInOriginalCodeError(uri, syntaxErrorsInOriginalCode)); + return invalidTest(new SyntaxErrorsInOriginalCodeError(syntaxErrorsInOriginalCode, uri)); } // Expected formatted code must not contain syntax errors const syntaxErrorsInExpectedFormattedCode = await getSyntaxErrors(services, expectedFormattedCode); if (syntaxErrorsInExpectedFormattedCode.length > 0) { - return invalidTest(uri, new SyntaxErrorsInExpectedFormattedCodeError(uri, syntaxErrorsInExpectedFormattedCode)); + return invalidTest(new SyntaxErrorsInExpectedFormattedCodeError(syntaxErrorsInExpectedFormattedCode, uri)); } const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); @@ -51,11 +51,10 @@ const createFormattingTest = async (uri: URI): Promise => { /** * Report a test that has errors. * - * @param uri The URI of the test file or test suite. * @param error The error that occurred. */ -const invalidTest = (uri: URI, error: Error): FormattingTest => { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (error: TestDescriptionError): FormattingTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); return { testName: `INVALID TEST FILE [${shortenedResourceName}]`, originalCode: '', @@ -98,30 +97,39 @@ interface FormattingTest extends TestDescription { /** * The file contains no or more than one separator. */ -class SeparatorError extends Error { - constructor(readonly uri: URI, readonly number_of_separators: number) { - super(`Expected exactly one separator in ${uri.toString()} but found ${number_of_separators}.`); +class SeparatorError extends TestDescriptionError { + constructor( + readonly number_of_separators: number, + uri: URI, + ) { + super(`Expected exactly one separator but found ${number_of_separators}.`, uri); } } /** * The original code contains syntax errors. */ -class SyntaxErrorsInOriginalCodeError extends Error { - constructor(readonly uri: URI, readonly syntaxErrors: Diagnostic[]) { +class SyntaxErrorsInOriginalCodeError extends TestDescriptionError { + constructor( + readonly syntaxErrors: Diagnostic[], + uri: URI, + ) { const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); - super(`Original code in ${uri.toString()} has syntax errors:\n${syntaxErrorsAsString}`); + super(`Original code has syntax errors:\n${syntaxErrorsAsString}`, uri); } } /** * The expected formatted code contains syntax errors. */ -class SyntaxErrorsInExpectedFormattedCodeError extends Error { - constructor(readonly uri: URI, readonly syntaxErrors: Diagnostic[]) { +class SyntaxErrorsInExpectedFormattedCodeError extends TestDescriptionError { + constructor( + readonly syntaxErrors: Diagnostic[], + uri: URI, + ) { const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); - super(`Expected formatted code in ${uri.toString()} has syntax errors:\n${syntaxErrorsAsString}`); + super(`Expected formatted code has syntax errors:\n${syntaxErrorsAsString}`, uri); } } diff --git a/tests/language/generation/creator.ts b/tests/language/generation/creator.ts index fddaff810..da3b4c2b8 100644 --- a/tests/language/generation/creator.ts +++ b/tests/language/generation/creator.ts @@ -10,7 +10,7 @@ import { ErrorsInCodeError, getErrors } from '../../helpers/diagnostics.js'; import { findTestChecks } from '../../helpers/testChecks.js'; import { Location } from 'vscode-languageserver'; import { NodeFileSystem } from 'langium/node'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; import { locationToString } from '../../helpers/location.js'; import { URI } from 'langium'; @@ -37,19 +37,19 @@ const createGenerationTest = async (parentDirectory: URI, inputUris: URI[]): Pro // File must not contain any errors const errors = await getErrors(services, code); if (errors.length > 0) { - return invalidTest('FILE', uri, new ErrorsInCodeError(errors)); + return invalidTest('FILE', new ErrorsInCodeError(errors, uri)); } const checksResult = findTestChecks(code, uri, { failIfFewerRangesThanComments: true }); // Something went wrong when finding test checks if (checksResult.isErr) { - return invalidTest('FILE', uri, checksResult.error); + return invalidTest('FILE', checksResult.error); } // Must contain at most one comment if (checksResult.value.length > 1) { - return invalidTest('FILE', uri, new MultipleChecksError(checksResult.value.length)); + return invalidTest('FILE', new MultipleChecksError(checksResult.value.length, uri)); } // Comment must match the expected format @@ -58,14 +58,14 @@ const createGenerationTest = async (parentDirectory: URI, inputUris: URI[]): Pro // Expected unresolved reference if (check.comment !== 'run_until') { - return invalidTest('FILE', uri, new InvalidCommentError(check.comment)); + return invalidTest('FILE', new InvalidCommentError(check.comment, uri)); } } // Must not contain multiple run_until locations in various files const newRunUntil = checksResult.value[0]?.location; if (runUntil && newRunUntil) { - return invalidTest('SUITE', parentDirectory, new MultipleRunUntilLocationsError([runUntil, newRunUntil])); + return invalidTest('SUITE', new MultipleRunUntilLocationsError([runUntil, newRunUntil], parentDirectory)); } runUntil = newRunUntil; @@ -100,11 +100,10 @@ const readExpectedOutputFiles = (expectedOutputRoot: URI, actualOutputRoot: URI) * Report a test that has errors. * * @param level Whether a test file or a test suite is invalid. - * @param uri The URI of the test file or test suite. * @param error The error that occurred. */ -const invalidTest = (level: 'FILE' | 'SUITE', uri: URI, error: Error): GenerationTest => { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): GenerationTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; return { testName, @@ -158,27 +157,36 @@ interface ExpectedOutputFile { /** * Found multiple test checks. */ -class MultipleChecksError extends Error { - constructor(readonly count: number) { - super(`Found ${count} test checks (generation tests expect none or one).`); +class MultipleChecksError extends TestDescriptionError { + constructor( + readonly count: number, + uri: URI, + ) { + super(`Found ${count} test checks (generation tests expect none or one).`, uri); } } /** * A test comment did not match the expected format. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { - super(`Invalid test comment (valid values 'run_until'): ${comment}`); +class InvalidCommentError extends TestDescriptionError { + constructor( + readonly comment: string, + uri: URI, + ) { + super(`Invalid test comment (valid values 'run_until'): ${comment}`, uri); } } /** * Multiple files have a run_until locations. */ -class MultipleRunUntilLocationsError extends Error { - constructor(readonly locations: Location[]) { +class MultipleRunUntilLocationsError extends TestDescriptionError { + constructor( + readonly locations: Location[], + uri: URI, + ) { const locationsString = locations.map((it) => `\n - ${locationToString(it)}`).join(''); - super(`Found multiple run_until locations:${locationsString}`); + super(`Found multiple run_until locations:${locationsString}`, uri); } } diff --git a/tests/language/grammar/creator.ts b/tests/language/grammar/creator.ts index 2718482fc..104b83a3a 100644 --- a/tests/language/grammar/creator.ts +++ b/tests/language/grammar/creator.ts @@ -2,7 +2,7 @@ import { listSafeDsFiles, uriToShortenedResourceName } from '../../helpers/testR import fs from 'fs'; import { findTestComments } from '../../helpers/testComments.js'; import { NoCommentsError } from '../../helpers/testChecks.js'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; import { URI } from 'langium'; const rootResourceName = 'grammar'; @@ -17,19 +17,19 @@ const createGrammarTest = (uri: URI): GrammarTest => { // Must contain at least one comment if (comments.length === 0) { - return invalidTest(uri, new NoCommentsError()); + return invalidTest(new NoCommentsError(uri)); } // Must contain no more than one comment if (comments.length > 1) { - return invalidTest(uri, new MultipleCommentsError(comments)); + return invalidTest(new MultipleCommentsError(comments, uri)); } const comment = comments[0]; // Must contain a valid comment if (comment !== 'syntax_error' && comment !== 'no_syntax_error') { - return invalidTest(uri, new InvalidCommentError(comment)); + return invalidTest(new InvalidCommentError(comment, uri)); } const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); @@ -51,11 +51,10 @@ const createGrammarTest = (uri: URI): GrammarTest => { /** * Report a test that has errors. * - * @param uri The URI of the test file. * @param error The error that occurred. */ -const invalidTest = (uri: URI, error: Error): GrammarTest => { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (error: TestDescriptionError): GrammarTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); return { testName: `INVALID TEST FILE [${shortenedResourceName}]`, code: '', @@ -88,17 +87,23 @@ interface GrammarTest extends TestDescription { /** * Found multiple test comments. */ -class MultipleCommentsError extends Error { - constructor(readonly comments: string[]) { - super(`Found multiple test comments (grammar tests expect only one): ${comments}`); +class MultipleCommentsError extends TestDescriptionError { + constructor( + readonly comments: string[], + uri: URI, + ) { + super(`Found multiple test comments (grammar tests expect only one): ${comments}`, uri); } } /** * Found one test comment but it was invalid. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { - super(`Invalid test comment (valid values are 'syntax_error' and 'no_syntax_error'): ${comment}`); +class InvalidCommentError extends TestDescriptionError { + constructor( + readonly comment: string, + uri: URI, + ) { + super(`Invalid test comment (valid values are 'syntax_error' and 'no_syntax_error'): ${comment}`, uri); } } diff --git a/tests/language/partialEvaluation/creator.ts b/tests/language/partialEvaluation/creator.ts index 83c8e1467..976d0182c 100644 --- a/tests/language/partialEvaluation/creator.ts +++ b/tests/language/partialEvaluation/creator.ts @@ -5,7 +5,7 @@ import { Location } from 'vscode-languageserver'; import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'partial evaluation'; @@ -28,14 +28,14 @@ const createPartialEvaluationTest = async (parentDirectory: URI, uris: URI[]): P // File must not contain any syntax errors const syntaxErrors = await getSyntaxErrors(services, code); if (syntaxErrors.length > 0) { - return invalidTest('FILE', uri, new SyntaxErrorsInCodeError(syntaxErrors)); + return invalidTest('FILE', new SyntaxErrorsInCodeError(syntaxErrors, uri)); } const checksResult = findTestChecks(code, uri, { failIfFewerRangesThanComments: true }); // Something went wrong when finding test checks if (checksResult.isErr) { - return invalidTest('FILE', uri, checksResult.error); + return invalidTest('FILE', checksResult.error); } for (const check of checksResult.value) { @@ -69,14 +69,14 @@ const createPartialEvaluationTest = async (parentDirectory: URI, uris: URI[]): P continue; } - return invalidTest('FILE', uri, new InvalidCommentError(check.comment)); + return invalidTest('FILE', new InvalidCommentError(check.comment, uri)); } } // Check that all equivalence classes have at least two locations for (const [id, locations] of groupIdToLocations) { if (locations.length < 2) { - return invalidTest('SUITE', parentDirectory, new SingletonEquivalenceClassError(id)); + return invalidTest('SUITE', new SingletonEquivalenceClassError(id, parentDirectory)); } } @@ -94,11 +94,10 @@ const createPartialEvaluationTest = async (parentDirectory: URI, uris: URI[]): P * Report a test that has errors. * * @param level Whether a test file or a test suite is invalid. - * @param uri The URI of the test file or test suite. * @param error The error that occurred. */ -const invalidTest = (level: 'FILE' | 'SUITE', uri: URI, error: Error): PartialEvaluationTest => { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): PartialEvaluationTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; return { testName, @@ -173,10 +172,14 @@ interface UndefinedAssertion { /** * A test comment did not match the expected format. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { +class InvalidCommentError extends TestDescriptionError { + constructor( + readonly comment: string, + uri: URI, + ) { super( `Invalid test comment (valid values are 'constant equivalence_class ', 'constant serialization ', and 'not constant'): ${comment}`, + uri, ); } } @@ -184,8 +187,11 @@ class InvalidCommentError extends Error { /** * An equivalence class test contains only a single location. */ -class SingletonEquivalenceClassError extends Error { - constructor(readonly id: string) { - super(`Equivalence class '${id}' only contains a single location. Such an assertion always succeeds.`); +class SingletonEquivalenceClassError extends TestDescriptionError { + constructor( + readonly id: string, + uri: URI, + ) { + super(`Equivalence class '${id}' only contains a single location. Such an assertion always succeeds.`, uri); } } diff --git a/tests/language/scoping/creator.ts b/tests/language/scoping/creator.ts index 57d0e0360..d0df838e6 100644 --- a/tests/language/scoping/creator.ts +++ b/tests/language/scoping/creator.ts @@ -5,7 +5,7 @@ import { Location } from 'vscode-languageserver'; import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'scoping'; @@ -27,14 +27,14 @@ const createScopingTest = async (parentDirectory: URI, uris: URI[]): Promise 0) { - return invalidTest('FILE', uri, new SyntaxErrorsInCodeError(syntaxErrors)); + return invalidTest('FILE', new SyntaxErrorsInCodeError(syntaxErrors, uri)); } const checksResult = findTestChecks(code, uri, { failIfFewerRangesThanComments: true }); // Something went wrong when finding test checks if (checksResult.isErr) { - return invalidTest('FILE', uri, checksResult.error); + return invalidTest('FILE', checksResult.error); } for (const check of checksResult.value) { @@ -62,7 +62,7 @@ const createScopingTest = async (parentDirectory: URI, uris: URI[]): Promise { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): ScopingTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; return { testName, @@ -173,10 +172,14 @@ interface Target { /** * A test comment did not match the expected format. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { +class InvalidCommentError extends TestDescriptionError { + constructor( + readonly comment: string, + uri: URI, + ) { super( `Invalid test comment (valid values are 'references ', 'unresolved', and 'target '): ${comment}`, + uri, ); } } @@ -184,17 +187,23 @@ class InvalidCommentError extends Error { /** * Several targets have the same ID. */ -class DuplicateTargetIdError extends Error { - constructor(readonly id: string) { - super(`Target ID ${id} is used more than once`); +class DuplicateTargetIdError extends TestDescriptionError { + constructor( + readonly id: string, + uri: URI, + ) { + super(`Target ID ${id} is used more than once`, uri); } } /** * A reference points to a target that does not exist. */ -class MissingTargetError extends Error { - constructor(readonly targetId: string) { - super(`No target with ID ${targetId} exists`); +class MissingTargetError extends TestDescriptionError { + constructor( + readonly targetId: string, + uri: URI, + ) { + super(`No target with ID ${targetId} exists`, uri); } } diff --git a/tests/language/typing/creator.ts b/tests/language/typing/creator.ts index 49342337a..306af29b9 100644 --- a/tests/language/typing/creator.ts +++ b/tests/language/typing/creator.ts @@ -5,7 +5,7 @@ import { Location } from 'vscode-languageserver'; import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; -import { TestDescription } from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'typing'; @@ -27,14 +27,14 @@ const createTypingTest = async (parentDirectory: URI, uris: URI[]): Promise 0) { - return invalidTest('FILE', uri, new SyntaxErrorsInCodeError(syntaxErrors)); + return invalidTest('FILE', new SyntaxErrorsInCodeError(syntaxErrors, uri)); } const checksResult = findTestChecks(code, uri, { failIfFewerRangesThanComments: true }); // Something went wrong when finding test checks if (checksResult.isErr) { - return invalidTest('FILE', uri, checksResult.error); + return invalidTest('FILE', checksResult.error); } for (const check of checksResult.value) { @@ -59,14 +59,14 @@ const createTypingTest = async (parentDirectory: URI, uris: URI[]): Promise { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): TypingTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; return { testName, @@ -146,10 +145,14 @@ interface SerializationAssertion { /** * A test comment did not match the expected format. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { +class InvalidCommentError extends TestDescriptionError { + constructor( + readonly comment: string, + uri: URI, + ) { super( `Invalid test comment (valid values are 'equivalence_class ' and 'serialization '): ${comment}`, + uri, ); } } @@ -157,8 +160,11 @@ class InvalidCommentError extends Error { /** * An equivalence class test contains only a single location. */ -class SingletonEquivalenceClassError extends Error { - constructor(readonly id: string) { - super(`Equivalence class '${id}' only contains a single location. Such an assertion always succeeds.`); +class SingletonEquivalenceClassError extends TestDescriptionError { + constructor( + readonly id: string, + uri: URI, + ) { + super(`Equivalence class '${id}' only contains a single location. Such an assertion always succeeds.`, uri); } } diff --git a/tests/language/validation/creator.ts b/tests/language/validation/creator.ts index fc2c9ba4e..99fbf6812 100644 --- a/tests/language/validation/creator.ts +++ b/tests/language/validation/creator.ts @@ -1,11 +1,11 @@ import { listSafeDsFilesGroupedByParentDirectory, uriToShortenedResourceName } from '../../helpers/testResources.js'; import fs from 'fs'; import { findTestChecks } from '../../helpers/testChecks.js'; -import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; +import {getSyntaxErrors, SyntaxErrorsInCodeError} from '../../helpers/diagnostics.js'; import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; import { Range } from 'vscode-languageserver-types'; -import { TestDescription } from '../../helpers/testDescription.js'; +import {TestDescription, TestDescriptionError} from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'validation'; @@ -26,14 +26,14 @@ const createValidationTest = async (parentDirectory: URI, uris: URI[]): Promise< // File must not contain any syntax errors const syntaxErrors = await getSyntaxErrors(services, code); if (syntaxErrors.length > 0) { - return invalidTest(uri, new SyntaxErrorsInCodeError(syntaxErrors)); + return invalidTest(new SyntaxErrorsInCodeError(syntaxErrors, uri)); } const checksResult = findTestChecks(code, uri); // Something went wrong when finding test checks if (checksResult.isErr) { - return invalidTest(uri, checksResult.error); + return invalidTest(checksResult.error); } for (const check of checksResult.value) { @@ -42,7 +42,7 @@ const createValidationTest = async (parentDirectory: URI, uris: URI[]): Promise< // Overall comment is invalid if (!match) { - return invalidTest(uri, new InvalidCommentError(check.comment)); + return invalidTest(new InvalidCommentError(check.comment, uri)); } // Extract groups from the match @@ -53,7 +53,7 @@ const createValidationTest = async (parentDirectory: URI, uris: URI[]): Promise< // Validate the severity if (!validSeverities.includes(severity as any)) { - return invalidTest(uri, new InvalidSeverityError(severity)); + return invalidTest(new InvalidSeverityError(severity, uri)); } // Add the issue @@ -79,11 +79,10 @@ const createValidationTest = async (parentDirectory: URI, uris: URI[]): Promise< /** * Report a test that has errors. * - * @param uri The URI of the test file. * @param error The error that occurred. */ -const invalidTest = (uri: URI, error: Error): ValidationTest => { - const shortenedResourceName = uriToShortenedResourceName(uri, rootResourceName); +const invalidTest = (error: TestDescriptionError): ValidationTest => { + const shortenedResourceName = uriToShortenedResourceName(error.uri, rootResourceName); const testName = `INVALID TEST FILE [${shortenedResourceName}]`; return { testName, @@ -161,17 +160,17 @@ export type Severity = (typeof validSeverities)[number]; /** * A test comment did not match the expected format. */ -class InvalidCommentError extends Error { - constructor(readonly comment: string) { - super(`Invalid test comment (refer to the documentation for guidance): ${comment}`); +class InvalidCommentError extends TestDescriptionError { + constructor(readonly comment: string, uri: URI) { + super(`Invalid test comment (refer to the documentation for guidance): ${comment}`, uri); } } /** * A test comment did not specify a valid severity. */ -class InvalidSeverityError extends Error { - constructor(readonly type: string) { - super(`Invalid severity (valid values are ${validSeverities.join(', ')}): ${type}`); +class InvalidSeverityError extends TestDescriptionError { + constructor(readonly type: string, uri: URI) { + super(`Invalid severity (valid values are ${validSeverities.join(', ')}): ${type}`, uri); } } From e4c30f4e22dab97fa2f9be9e4aab519a483bb969 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 10:46:09 +0200 Subject: [PATCH 04/16] feat: update formatter to handle lists and maps --- src/language/formatting/safe-ds-formatter.ts | 59 ++++++++++++++++++- .../expressions/lists/complex element.sdstest | 11 ++++ .../expressions/maps/complex key.sdstest | 11 ++++ .../expressions/maps/complex value.sdstest | 11 ++++ ...stest => nested multiple elements.sdstest} | 0 ...ent.sdstest => nested one element.sdstest} | 4 +- ...st => one level multiple elements.sdstest} | 0 ....sdstest => one level one element.sdstest} | 0 .../elements of list (complex).sdstest | 6 +- .../trailing commas/elements of list.sdstest | 4 +- ...entries of map (one literal entry).sdstest | 2 +- 11 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 tests/resources/formatting/expressions/lists/complex element.sdstest create mode 100644 tests/resources/formatting/expressions/maps/complex key.sdstest create mode 100644 tests/resources/formatting/expressions/maps/complex value.sdstest rename tests/resources/formatting/expressions/maps/{good-nested multiple elements.sdstest => nested multiple elements.sdstest} (100%) rename tests/resources/formatting/expressions/maps/{good-nested one element.sdstest => nested one element.sdstest} (79%) rename tests/resources/formatting/expressions/maps/{good-one level multiple elements.sdstest => one level multiple elements.sdstest} (100%) rename tests/resources/formatting/expressions/maps/{good-one level one element.sdstest => one level one element.sdstest} (100%) diff --git a/src/language/formatting/safe-ds-formatter.ts b/src/language/formatting/safe-ds-formatter.ts index 86e31d406..7513cc0f0 100644 --- a/src/language/formatting/safe-ds-formatter.ts +++ b/src/language/formatting/safe-ds-formatter.ts @@ -142,6 +142,12 @@ export class SafeDsFormatter extends AbstractFormatter { this.formatSdsIndexedAccess(node); } else if (ast.isSdsMemberAccess(node)) { this.formatSdsMemberAccess(node); + } else if (ast.isSdsList(node)) { + this.formatSdsList(node); + } else if (ast.isSdsMap(node)) { + this.formatSdsMap(node); + } else if (ast.isSdsMapEntry(node)) { + this.formatSdsMapEntry(node); } else if (ast.isSdsParenthesizedExpression(node)) { this.formatSdsParenthesizedExpression(node); } else if (ast.isSdsTemplateStringStart(node)) { @@ -727,6 +733,55 @@ export class SafeDsFormatter extends AbstractFormatter { formatter.keyword('.').surround(noSpace()); } + private formatSdsList(node: ast.SdsList) { + const formatter = this.getNodeFormatter(node); + + const openingSquareBracket = formatter.keyword('['); + const closingSquareBracket = formatter.keyword(']'); + + const elements = node.elements; + + if (elements.some((it) => this.isComplexExpression(it))) { + formatter.nodes(...elements).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingSquareBracket.prepend(newLine()); + } else { + openingSquareBracket.append(noSpace()); + formatter.nodes(...elements.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingSquareBracket.prepend(noSpace()); + } + } + + private formatSdsMap(node: ast.SdsMap) { + const formatter = this.getNodeFormatter(node); + + const openingCurlyBrace = formatter.keyword('{'); + const closingCurlyBrace = formatter.keyword('}'); + + const entries = node.entries; + + if ( + entries.length >= 2 || + entries.some((it) => this.isComplexExpression(it.key) || this.isComplexExpression(it.value)) + ) { + formatter.nodes(...entries).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingCurlyBrace.prepend(newLine()); + } else { + openingCurlyBrace.append(noSpace()); + formatter.nodes(...entries.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingCurlyBrace.prepend(noSpace()); + } + } + + private formatSdsMapEntry(node: ast.SdsMapEntry) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + private formatSdsParenthesizedExpression(node: ast.SdsParenthesizedExpression): void { const formatter = this.getNodeFormatter(node); @@ -754,12 +809,12 @@ export class SafeDsFormatter extends AbstractFormatter { /** * Returns whether the expression is considered complex and requires special formatting like placing the associated - * argument on its own line. + * expression on its own line. * * @param node The expression to check. */ private isComplexExpression(node: ast.SdsExpression | undefined): boolean { - return ast.isSdsChainedExpression(node); + return ast.isSdsChainedExpression(node) || ast.isSdsList(node) || ast.isSdsMap(node); } // ----------------------------------------------------------------------------- diff --git a/tests/resources/formatting/expressions/lists/complex element.sdstest b/tests/resources/formatting/expressions/lists/complex element.sdstest new file mode 100644 index 000000000..2d2beaf46 --- /dev/null +++ b/tests/resources/formatting/expressions/lists/complex element.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + [ f ( ) ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + [ + f() + ]; +} diff --git a/tests/resources/formatting/expressions/maps/complex key.sdstest b/tests/resources/formatting/expressions/maps/complex key.sdstest new file mode 100644 index 000000000..f53264f36 --- /dev/null +++ b/tests/resources/formatting/expressions/maps/complex key.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + { f ( ) : 1 }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + f(): 1 + }; +} diff --git a/tests/resources/formatting/expressions/maps/complex value.sdstest b/tests/resources/formatting/expressions/maps/complex value.sdstest new file mode 100644 index 000000000..14cea3fff --- /dev/null +++ b/tests/resources/formatting/expressions/maps/complex value.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + { 1 : f ( ) }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + { + 1: f() + }; +} diff --git a/tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest b/tests/resources/formatting/expressions/maps/nested multiple elements.sdstest similarity index 100% rename from tests/resources/formatting/expressions/maps/good-nested multiple elements.sdstest rename to tests/resources/formatting/expressions/maps/nested multiple elements.sdstest diff --git a/tests/resources/formatting/expressions/maps/good-nested one element.sdstest b/tests/resources/formatting/expressions/maps/nested one element.sdstest similarity index 79% rename from tests/resources/formatting/expressions/maps/good-nested one element.sdstest rename to tests/resources/formatting/expressions/maps/nested one element.sdstest index 07f7e1dab..ad8a6936a 100644 --- a/tests/resources/formatting/expressions/maps/good-nested one element.sdstest +++ b/tests/resources/formatting/expressions/maps/nested one element.sdstest @@ -6,8 +6,6 @@ pipeline myPipeline { pipeline myPipeline { { - 1: { - 2: "three" - } + 1: {2: "three"} }; } diff --git a/tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest b/tests/resources/formatting/expressions/maps/one level multiple elements.sdstest similarity index 100% rename from tests/resources/formatting/expressions/maps/good-one level multiple elements.sdstest rename to tests/resources/formatting/expressions/maps/one level multiple elements.sdstest diff --git a/tests/resources/formatting/expressions/maps/good-one level one element.sdstest b/tests/resources/formatting/expressions/maps/one level one element.sdstest similarity index 100% rename from tests/resources/formatting/expressions/maps/good-one level one element.sdstest rename to tests/resources/formatting/expressions/maps/one level one element.sdstest diff --git a/tests/resources/formatting/trailing commas/elements of list (complex).sdstest b/tests/resources/formatting/trailing commas/elements of list (complex).sdstest index 302116b57..451b281fc 100644 --- a/tests/resources/formatting/trailing commas/elements of list (complex).sdstest +++ b/tests/resources/formatting/trailing commas/elements of list (complex).sdstest @@ -1,12 +1,12 @@ pipeline myPipeline { - [ 1 + 2 , 2 ]; + [ f ( ) , 2 , ]; } // ----------------------------------------------------------------------------- pipeline myPipeline { [ - 1 + 2, - 2 + f(), + 2, ]; } diff --git a/tests/resources/formatting/trailing commas/elements of list.sdstest b/tests/resources/formatting/trailing commas/elements of list.sdstest index d389dcd65..e8d34cb0f 100644 --- a/tests/resources/formatting/trailing commas/elements of list.sdstest +++ b/tests/resources/formatting/trailing commas/elements of list.sdstest @@ -1,9 +1,9 @@ pipeline myPipeline { - [ 1 , 2 ]; + [ 1 , 2 , ]; } // ----------------------------------------------------------------------------- pipeline myPipeline { - [1, 2]; + [1, 2,]; } diff --git a/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest b/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest index 3d45f89a4..629a16171 100644 --- a/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest +++ b/tests/resources/formatting/trailing commas/entries of map (one literal entry).sdstest @@ -5,5 +5,5 @@ pipeline myPipeline { // ----------------------------------------------------------------------------- pipeline myPipeline { - {1: "one", }; + {1: "one",}; } From 31f4ed5cc206eb46d6cdd1d2d002d2d3fd92323e Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 10:50:15 +0200 Subject: [PATCH 05/16] refactor: make list and map subtypes of literal --- src/language/grammar/safe-ds.langium | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/language/grammar/safe-ds.langium b/src/language/grammar/safe-ds.langium index 69d2c5063..269e10a4c 100644 --- a/src/language/grammar/safe-ds.langium +++ b/src/language/grammar/safe-ds.langium @@ -721,28 +721,20 @@ SdsCallArgument returns SdsArgument: ; SdsPrimaryExpression returns SdsExpression: - SdsList - | SdsLiteral - | SdsMap + SdsLiteral | SdsParenthesizedExpression | SdsReference | SdsTemplateString ; -interface SdsList extends SdsExpression { - elements: SdsExpression[] -} - -SdsList returns SdsList: - {SdsList} '[' (elements+=SdsExpression (',' elements+=SdsExpression)* ','? )? ']' -; - interface SdsLiteral extends SdsExpression {} SdsLiteral returns SdsLiteral: SdsBoolean | SdsFloat | SdsInt + | SdsList + | SdsMap | SdsNull | SdsString ; @@ -774,21 +766,15 @@ SdsInt returns SdsInt: value=INT ; -interface SdsNull extends SdsLiteral {} - -SdsNull returns SdsNull: - {SdsNull} 'null' -; - -interface SdsString extends SdsLiteral { - value: string +interface SdsList extends SdsLiteral { + elements: SdsExpression[] } -SdsString returns SdsString: - value=STRING +SdsList returns SdsList: + {SdsList} '[' (elements+=SdsExpression (',' elements+=SdsExpression)* ','? )? ']' ; -interface SdsMap extends SdsExpression { +interface SdsMap extends SdsLiteral { entries: SdsMapEntry[] } @@ -805,6 +791,20 @@ SdsMapEntry returns SdsMapEntry: key=SdsExpression ':' value=SdsExpression ; +interface SdsNull extends SdsLiteral {} + +SdsNull returns SdsNull: + {SdsNull} 'null' +; + +interface SdsString extends SdsLiteral { + value: string +} + +SdsString returns SdsString: + value=STRING +; + interface SdsParenthesizedExpression extends SdsExpression { expression: SdsExpression } From 9d4cd1998cbfafe30032159748cae690c2f5fc76 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:08:26 +0200 Subject: [PATCH 06/16] feat: update type computer --- src/language/builtins/safe-ds-classes.ts | 11 ++++-- src/language/typing/safe-ds-type-computer.ts | 37 ++++++++++++++++--- .../builtins/safeds/lang/coreClasses.sdsstub | 9 +++++ .../expressions/indexed accesses/main.sdstest | 20 ++++++---- .../typing/expressions/lists/main.sdstest | 8 ++++ .../typing/expressions/maps/main.sdstest | 8 ++++ 6 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 tests/resources/typing/expressions/lists/main.sdstest create mode 100644 tests/resources/typing/expressions/maps/main.sdstest diff --git a/src/language/builtins/safe-ds-classes.ts b/src/language/builtins/safe-ds-classes.ts index a42551246..4ae5a8404 100644 --- a/src/language/builtins/safe-ds-classes.ts +++ b/src/language/builtins/safe-ds-classes.ts @@ -5,13 +5,10 @@ import { SafeDsModuleMembers } from './safe-ds-module-members.js'; const CORE_CLASSES_URI = resolveRelativePathToBuiltinFile('safeds/lang/coreClasses.sdsstub'); export class SafeDsClasses extends SafeDsModuleMembers { - /* c8 ignore start */ get Any(): SdsClass | undefined { return this.getClass('Any'); } - /* c8 ignore stop */ - get Boolean(): SdsClass | undefined { return this.getClass('Boolean'); } @@ -24,6 +21,14 @@ export class SafeDsClasses extends SafeDsModuleMembers { return this.getClass('Int'); } + get List(): SdsClass | undefined { + return this.getClass('List'); + } + + get Map(): SdsClass | undefined { + return this.getClass('Map'); + } + get Nothing(): SdsClass | undefined { return this.getClass('Nothing'); } diff --git a/src/language/typing/safe-ds-type-computer.ts b/src/language/typing/safe-ds-type-computer.ts index 3ee0abfd8..44222ea46 100644 --- a/src/language/typing/safe-ds-type-computer.ts +++ b/src/language/typing/safe-ds-type-computer.ts @@ -39,7 +39,9 @@ import { isSdsInfixOperation, isSdsInt, isSdsLambda, + isSdsList, isSdsLiteralType, + isSdsMap, isSdsMemberAccess, isSdsMemberType, isSdsNamedType, @@ -65,6 +67,7 @@ import { SdsDeclaration, SdsExpression, SdsFunction, + SdsIndexedAccess, SdsInfixOperation, SdsParameter, SdsPrefixOperation, @@ -259,6 +262,10 @@ export class SafeDsTypeComputer { return this.Float(); } else if (isSdsInt(node)) { return this.Int(); + } else if (isSdsList(node)) { + return this.List(); + } else if (isSdsMap(node)) { + return this.Map(); } else if (isSdsNull(node)) { return this.NothingOrNull(); } else if (isSdsString(node)) { @@ -289,12 +296,7 @@ export class SafeDsTypeComputer { return new CallableType(node, new NamedTupleType(parameterEntries), new NamedTupleType(resultEntries)); } else if (isSdsIndexedAccess(node)) { - const receiverType = this.computeType(node.receiver); - if (receiverType instanceof VariadicType) { - return receiverType.elementType; - } else { - return UnknownType; - } + return this.computeTypeOfIndexedAccess(node); } else if (isSdsInfixOperation(node)) { switch (node.operator) { // Boolean operators @@ -373,6 +375,17 @@ export class SafeDsTypeComputer { return UnknownType; } + private computeTypeOfIndexedAccess(node: SdsIndexedAccess): Type { + const receiverType = this.computeType(node.receiver); + if (receiverType.equals(this.List()) || receiverType.equals(this.Map())) { + return this.AnyOrNull(); + } else if (receiverType instanceof VariadicType) { + return receiverType.elementType; + } else { + return UnknownType; + } + } + private computeTypeOfArithmeticInfixOperation(node: SdsInfixOperation): Type { const leftOperandType = this.computeType(node.leftOperand); const rightOperandType = this.computeType(node.rightOperand); @@ -501,6 +514,10 @@ export class SafeDsTypeComputer { // Builtin types // ----------------------------------------------------------------------------------------------------------------- + private AnyOrNull(): Type { + return this.createCoreType(this.coreClasses.Any, true); + } + private Boolean(): Type { return this.createCoreType(this.coreClasses.Boolean); } @@ -513,6 +530,14 @@ export class SafeDsTypeComputer { return this.createCoreType(this.coreClasses.Int); } + private List(): Type { + return this.createCoreType(this.coreClasses.List); + } + + private Map(): Type { + return this.createCoreType(this.coreClasses.Map); + } + private NothingOrNull(): Type { return this.createCoreType(this.coreClasses.Nothing, true); } diff --git a/src/resources/builtins/safeds/lang/coreClasses.sdsstub b/src/resources/builtins/safeds/lang/coreClasses.sdsstub index 857657ea9..0ad91db59 100644 --- a/src/resources/builtins/safeds/lang/coreClasses.sdsstub +++ b/src/resources/builtins/safeds/lang/coreClasses.sdsstub @@ -18,5 +18,14 @@ class Int sub Number @Description("A floating-point number.") class Float sub Number +@Description("A floating-point number.") +class Float sub Number + +@Description("A list of elements.") +class List + +@Description("A map of keys to values.") +class Map + @Description("Some text.") class String diff --git a/tests/resources/typing/expressions/indexed accesses/main.sdstest b/tests/resources/typing/expressions/indexed accesses/main.sdstest index a4a495889..5ac2b4c3b 100644 --- a/tests/resources/typing/expressions/indexed accesses/main.sdstest +++ b/tests/resources/typing/expressions/indexed accesses/main.sdstest @@ -1,17 +1,23 @@ package tests.typing.expressions.indexedAccesses -// $TEST$ equivalence_class elementType -segment mySegment1(vararg params: »Int«) { - // $TEST$ equivalence_class elementType - »params[0]«; +// TODO: Improve once type parameters are supported +segment mySegment1(param: List) { + // $TEST$ serialization Any? + »param[0]«; } -segment mySegment2(params: String) { +// TODO: Improve once type parameters are supported +segment mySegment2(param: Map) { + // $TEST$ serialization Any? + »param[""]«; +} + +segment mySegment3(param: String) { // $TEST$ serialization $Unknown - »params[0]«; + »param[0]«; } -segment mySegment3() { +segment mySegment4() { // $TEST$ serialization $Unknown »unresolved[0]«; } diff --git a/tests/resources/typing/expressions/lists/main.sdstest b/tests/resources/typing/expressions/lists/main.sdstest new file mode 100644 index 000000000..f1ffb64b0 --- /dev/null +++ b/tests/resources/typing/expressions/lists/main.sdstest @@ -0,0 +1,8 @@ +package tests.typing.expressions.lists + +// TODO: Improve once type parameters are supported +pipeline myPipeline { + + // $TEST$ serialization List + »[]«; +} diff --git a/tests/resources/typing/expressions/maps/main.sdstest b/tests/resources/typing/expressions/maps/main.sdstest new file mode 100644 index 000000000..c9a6a7476 --- /dev/null +++ b/tests/resources/typing/expressions/maps/main.sdstest @@ -0,0 +1,8 @@ +package tests.typing.expressions.maps + +// TODO: Improve once type parameters are supported +pipeline myPipeline { + + // $TEST$ serialization Map + »{}«; +} From 9fde42c019a615c5e0e16562266ca590b46bf1f5 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:13:45 +0200 Subject: [PATCH 07/16] feat: remove `vararg` modifier from grammar --- src/language/grammar/safe-ds.langium | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/language/grammar/safe-ds.langium b/src/language/grammar/safe-ds.langium index 269e10a4c..f59772ff8 100644 --- a/src/language/grammar/safe-ds.langium +++ b/src/language/grammar/safe-ds.langium @@ -417,14 +417,13 @@ SdsParameterList returns SdsParameterList: interface SdsParameter extends SdsLocalVariable { isConstant: boolean - isVariadic: boolean ^type?: SdsType defaultValue?: SdsExpression } SdsParameter returns SdsParameter: annotationCalls+=SdsAnnotationCall* - (isConstant?='const' & isVariadic?='vararg') + isConstant?='const'? name=ID (':' ^type=SdsType)? ('=' defaultValue=SdsExpression)? From cc292f27999462dada875d2a80df968fafd7943e Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:13:54 +0200 Subject: [PATCH 08/16] fix: compilation errors --- src/language/helpers/nodeProperties.ts | 2 +- src/language/helpers/safe-ds-node-mapper.ts | 6 --- src/language/typing/model.ts | 28 ------------- src/language/typing/safe-ds-type-computer.ts | 10 +---- .../other/declarations/parameterLists.ts | 39 +------------------ .../other/declarations/parameters.ts | 14 ------- .../validation/other/types/callableTypes.ts | 2 +- src/language/validation/safe-ds-validator.ts | 11 +----- 8 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 src/language/validation/other/declarations/parameters.ts diff --git a/src/language/helpers/nodeProperties.ts b/src/language/helpers/nodeProperties.ts index f7a98aca5..fe08f4268 100644 --- a/src/language/helpers/nodeProperties.ts +++ b/src/language/helpers/nodeProperties.ts @@ -67,7 +67,7 @@ export const isNamedTypeArgument = (node: SdsTypeArgument): boolean => { }; export const isRequiredParameter = (node: SdsParameter): boolean => { - return !node.defaultValue && !node.isVariadic; + return !node.defaultValue; }; export const isStatic = (node: SdsClassMember): boolean => { diff --git a/src/language/helpers/safe-ds-node-mapper.ts b/src/language/helpers/safe-ds-node-mapper.ts index 0b3191532..8d7937df5 100644 --- a/src/language/helpers/safe-ds-node-mapper.ts +++ b/src/language/helpers/safe-ds-node-mapper.ts @@ -77,12 +77,6 @@ export class SafeDsNodeMapper { return parameters[argumentPosition]; } - // If no parameter is found, check if the last parameter is variadic - const lastParameter = parameters[parameters.length - 1]; - if (lastParameter?.isVariadic) { - return lastParameter; - } - return undefined; } diff --git a/src/language/typing/model.ts b/src/language/typing/model.ts index d24de68a5..d82651aaf 100644 --- a/src/language/typing/model.ts +++ b/src/language/typing/model.ts @@ -330,34 +330,6 @@ export class UnionType extends Type { } } -export class VariadicType extends Type { - override readonly isNullable = false; - - constructor(readonly elementType: Type) { - super(); - } - - override copyWithNullability(_isNullable: boolean): VariadicType { - return this; - } - - override equals(other: Type): boolean { - if (other === this) { - return true; - } - - if (!(other instanceof VariadicType)) { - return false; - } - - return other.elementType.equals(this.elementType); - } - - override toString(): string { - return `vararg<${this.elementType}>`; - } -} - class UnknownTypeClass extends Type { readonly isNullable = false; diff --git a/src/language/typing/safe-ds-type-computer.ts b/src/language/typing/safe-ds-type-computer.ts index 44222ea46..f3ce50c76 100644 --- a/src/language/typing/safe-ds-type-computer.ts +++ b/src/language/typing/safe-ds-type-computer.ts @@ -14,7 +14,6 @@ import { Type, UnionType, UnknownType, - VariadicType, } from './model.js'; import { isSdsAnnotation, @@ -203,12 +202,7 @@ export class SafeDsTypeComputer { private computeTypeOfParameter(node: SdsParameter): Type { // Manifest type if (node.type) { - const manifestParameterType = this.computeType(node.type); - if (node.isVariadic) { - return new VariadicType(manifestParameterType); - } else { - return manifestParameterType; - } + return this.computeType(node.type); } // Infer type from context @@ -379,8 +373,6 @@ export class SafeDsTypeComputer { const receiverType = this.computeType(node.receiver); if (receiverType.equals(this.List()) || receiverType.equals(this.Map())) { return this.AnyOrNull(); - } else if (receiverType instanceof VariadicType) { - return receiverType.elementType; } else { return UnknownType; } diff --git a/src/language/validation/other/declarations/parameterLists.ts b/src/language/validation/other/declarations/parameterLists.ts index e2458e5d8..662120353 100644 --- a/src/language/validation/other/declarations/parameterLists.ts +++ b/src/language/validation/other/declarations/parameterLists.ts @@ -1,27 +1,7 @@ import { SdsParameterList } from '../../../generated/ast.js'; import { ValidationAcceptor } from 'langium'; -export const CODE_PARAMETER_LIST_OPTIONAL_AND_VARIADIC = 'parameter-list/optional-and-variadic'; export const CODE_PARAMETER_LIST_REQUIRED_AFTER_OPTIONAL = 'parameter-list/required-after-optional'; -export const CODE_PARAMETER_LIST_VARIADIC_NOT_LAST = 'parameter-list/variadic-not-last'; - -export const parameterListMustNotHaveOptionalAndVariadicParameters = ( - node: SdsParameterList, - accept: ValidationAcceptor, -) => { - const hasOptional = node.parameters.find((p) => p.defaultValue); - if (hasOptional) { - const variadicRequiredParameters = node.parameters.filter((p) => p.isVariadic && !p.defaultValue); - - for (const variadic of variadicRequiredParameters) { - accept('error', 'A callable with optional parameters must not have a variadic parameter.', { - node: variadic, - property: 'name', - code: CODE_PARAMETER_LIST_OPTIONAL_AND_VARIADIC, - }); - } - } -}; export const parameterListMustNotHaveRequiredParametersAfterOptionalParameters = ( node: SdsParameterList, @@ -31,7 +11,7 @@ export const parameterListMustNotHaveRequiredParametersAfterOptionalParameters = for (const parameter of node.parameters) { if (parameter.defaultValue) { foundOptional = true; - } else if (foundOptional && !parameter.isVariadic) { + } else if (foundOptional) { accept('error', 'After the first optional parameter all parameters must be optional.', { node: parameter, property: 'name', @@ -40,20 +20,3 @@ export const parameterListMustNotHaveRequiredParametersAfterOptionalParameters = } } }; - -export const parameterListVariadicParameterMustBeLast = (node: SdsParameterList, accept: ValidationAcceptor) => { - let foundVariadic = false; - for (const parameter of node.parameters) { - if (foundVariadic) { - accept('error', 'After a variadic parameter no more parameters must be specified.', { - node: parameter, - property: 'name', - code: CODE_PARAMETER_LIST_VARIADIC_NOT_LAST, - }); - } - - if (parameter.isVariadic) { - foundVariadic = true; - } - } -}; diff --git a/src/language/validation/other/declarations/parameters.ts b/src/language/validation/other/declarations/parameters.ts deleted file mode 100644 index 473db1763..000000000 --- a/src/language/validation/other/declarations/parameters.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SdsParameter } from '../../../generated/ast.js'; -import { ValidationAcceptor } from 'langium'; - -export const CODE_PARAMETER_VARIADIC_AND_OPTIONAL = 'parameter/variadic-and-optional'; - -export const parameterMustNotBeVariadicAndOptional = (node: SdsParameter, accept: ValidationAcceptor) => { - if (node.isVariadic && node.defaultValue) { - accept('error', 'Variadic parameters must not be optional.', { - node, - property: 'name', - code: CODE_PARAMETER_VARIADIC_AND_OPTIONAL, - }); - } -}; diff --git a/src/language/validation/other/types/callableTypes.ts b/src/language/validation/other/types/callableTypes.ts index 6b593fcea..52a7d79e7 100644 --- a/src/language/validation/other/types/callableTypes.ts +++ b/src/language/validation/other/types/callableTypes.ts @@ -23,7 +23,7 @@ export const callableTypeParameterMustNotHaveConstModifier = ( export const callableTypeMustNotHaveOptionalParameters = (node: SdsCallableType, accept: ValidationAcceptor): void => { for (const parameter of parametersOrEmpty(node)) { - if (parameter.defaultValue && !parameter.isVariadic) { + if (parameter.defaultValue) { accept('error', 'A callable type must not have optional parameters.', { node: parameter, property: 'defaultValue', diff --git a/src/language/validation/safe-ds-validator.ts b/src/language/validation/safe-ds-validator.ts index 1b0e40bb5..43629e25b 100644 --- a/src/language/validation/safe-ds-validator.ts +++ b/src/language/validation/safe-ds-validator.ts @@ -36,11 +36,7 @@ import { yieldMustNotBeUsedInPipeline } from './other/statements/assignments.js' import { attributeMustHaveTypeHint, parameterMustHaveTypeHint, resultMustHaveTypeHint } from './types.js'; import { moduleDeclarationsMustMatchFileKind, moduleWithDeclarationsMustStatePackage } from './other/modules.js'; import { typeParameterConstraintLeftOperandMustBeOwnTypeParameter } from './other/declarations/typeParameterConstraints.js'; -import { - parameterListMustNotHaveOptionalAndVariadicParameters, - parameterListMustNotHaveRequiredParametersAfterOptionalParameters, - parameterListVariadicParameterMustBeLast, -} from './other/declarations/parameterLists.js'; +import { parameterListMustNotHaveRequiredParametersAfterOptionalParameters } from './other/declarations/parameterLists.js'; import { unionTypeMustHaveTypeArguments } from './other/types/unionTypes.js'; import { callableTypeMustNotHaveOptionalParameters, @@ -48,7 +44,6 @@ import { } from './other/types/callableTypes.js'; import { typeArgumentListMustNotHavePositionalArgumentsAfterNamedArguments } from './other/types/typeArgumentLists.js'; import { argumentListMustNotHavePositionalArgumentsAfterNamedArguments } from './other/argumentLists.js'; -import { parameterMustNotBeVariadicAndOptional } from './other/declarations/parameters.js'; import { referenceTargetMustNotBeAnnotationPipelineOrSchema } from './other/expressions/references.js'; import { annotationCallAnnotationShouldNotBeDeprecated, @@ -120,11 +115,9 @@ export const registerValidationChecks = function (services: SafeDsServices) { namedTypeDeclarationShouldNotBeExperimental(services), namedTypeTypeArgumentListShouldBeNeeded, ], - SdsParameter: [parameterMustHaveTypeHint, parameterMustNotBeVariadicAndOptional], + SdsParameter: [parameterMustHaveTypeHint], SdsParameterList: [ - parameterListMustNotHaveOptionalAndVariadicParameters, parameterListMustNotHaveRequiredParametersAfterOptionalParameters, - parameterListVariadicParameterMustBeLast, ], SdsPipeline: [pipelineMustContainUniqueNames], SdsPlaceholder: [placeholderShouldBeUsed(services)], From 1cfb8a48e894f7b5d3b076d9a70082dba7632395 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:19:37 +0200 Subject: [PATCH 09/16] fix: grammar tests --- .../good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 4 ---- ...ith const typed variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 4 ---- ...h const untyped variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 3 --- ...good-with typed variadic parameter.sdstest | 3 --- ...dic parameter (with default value).sdstest | 3 --- ...od-with untyped variadic parameter.sdstest | 3 --- .../classes/good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 4 ---- ...ith const typed variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 4 ---- ...h const untyped variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 3 --- ...good-with typed variadic parameter.sdstest | 3 --- ...dic parameter (with default value).sdstest | 3 --- ...od-with untyped variadic parameter.sdstest | 3 --- .../methods/good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 6 ----- ...ith const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...h const untyped variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 5 ---- ...good-with typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- ...od-with untyped variadic parameter.sdstest | 5 ---- .../good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 6 ----- ...ith const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...h const untyped variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 5 ---- ...good-with typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- ...od-with untyped variadic parameter.sdstest | 5 ---- .../variants/good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 8 ------- ...ith const typed variadic parameter.sdstest | 8 ------- ...dic parameter (with default value).sdstest | 8 ------- ...h const untyped variadic parameter.sdstest | 8 ------- ...dic parameter (with default value).sdstest | 7 ------ ...good-with typed variadic parameter.sdstest | 7 ------ ...dic parameter (with default value).sdstest | 7 ------ ...od-with untyped variadic parameter.sdstest | 7 ------ .../variants/good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 6 ----- ...ith const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...h const untyped variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 5 ---- ...good-with typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- ...od-with untyped variadic parameter.sdstest | 5 ---- .../good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 4 ---- ...ith const typed variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 4 ---- ...h const untyped variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 3 --- ...good-with typed variadic parameter.sdstest | 3 --- ...dic parameter (with default value).sdstest | 3 --- ...od-with untyped variadic parameter.sdstest | 3 --- .../segments/good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 4 ---- ...ith const typed variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 4 ---- ...h const untyped variadic parameter.sdstest | 4 ---- ...dic parameter (with default value).sdstest | 3 --- ...good-with typed variadic parameter.sdstest | 3 --- ...dic parameter (with default value).sdstest | 3 --- ...od-with untyped variadic parameter.sdstest | 3 --- .../good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 6 ----- ...ith const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...h const untyped variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 5 ---- ...good-with typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- ...od-with untyped variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 6 ----- ...ood-const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...d-const untyped variadic parameter.sdstest | 6 ----- .../good-multiple parameters.sdstest | 23 ++++--------------- ...dic parameter (with default value).sdstest | 5 ---- .../good-typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- .../good-untyped variadic parameter.sdstest | 5 ---- .../bad-unescaped vararg.sdstest | 3 --- .../good-escapedKeywords.sdstest | 1 - ...dic parameter (with default value).sdstest | 6 ----- ...ood-const typed variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 6 ----- ...d-const untyped variadic parameter.sdstest | 6 ----- ...dic parameter (with default value).sdstest | 5 ---- .../good-typed variadic parameter.sdstest | 5 ---- ...dic parameter (with default value).sdstest | 5 ---- .../good-untyped variadic parameter.sdstest | 5 ---- .../good-with multiple parameters.sdstest | 23 ++++--------------- 101 files changed, 55 insertions(+), 638 deletions(-) delete mode 100644 tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-const typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-const untyped variadic parameter.sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-typed variadic parameter.sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/grammar/types/callable types/good-untyped variadic parameter.sdstest diff --git a/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest index 7b0a5fea8..a20730150 100644 --- a/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest @@ -3,24 +3,11 @@ annotation MyAnnotation( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index e21a2fe73..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation1(const vararg a: Int = 1) -annotation MyAnnotation2(vararg const a: Int = 1) diff --git a/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 128c6560d..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation1(const vararg a: Int) -annotation MyAnnotation2(vararg const a: Int) diff --git a/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 4f5c91259..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation1(const vararg a = 1) -annotation MyAnnotation2(vararg const a = 1) diff --git a/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index b148d266a..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation1(const vararg a) -annotation MyAnnotation2(vararg const a) diff --git a/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index ae66c5f43..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation(vararg a: Int = 1) diff --git a/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest deleted file mode 100644 index 4688982bc..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation(vararg a: Int) diff --git a/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index c25497dbb..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation(vararg a = 1) diff --git a/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 9b68704d3..000000000 --- a/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MyAnnotation(vararg a) diff --git a/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest index f2098a136..93b84c6e0 100644 --- a/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest @@ -3,24 +3,11 @@ class MyClass( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 672ad428b..000000000 --- a/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass1(const vararg a: Int = 1) -class MyClass2(vararg const a: Int = 1) diff --git a/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 6a67e3a8e..000000000 --- a/tests/resources/grammar/declarations/classes/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass1(const vararg a: Int) -class MyClass2(vararg const a: Int) diff --git a/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 833c7962c..000000000 --- a/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass1(const vararg a = 1) -class MyClass2(vararg const a = 1) diff --git a/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index 22ceac251..000000000 --- a/tests/resources/grammar/declarations/classes/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass1(const vararg a) -class MyClass2(vararg const a) diff --git a/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 7d80bbf85..000000000 --- a/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass(vararg a: Int = 1) diff --git a/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest deleted file mode 100644 index d8d9493ee..000000000 --- a/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass(vararg a: Int) diff --git a/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 9e9ee04b3..000000000 --- a/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass(vararg a = 1) diff --git a/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 5335427be..000000000 --- a/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass(vararg a) diff --git a/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest index ad66eb930..27875ff07 100644 --- a/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest @@ -4,25 +4,12 @@ class MyClass { fun myFunction( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 984896442..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction1(const vararg a: Int = 1) - fun myFunction2(vararg const a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 64940ed4c..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction1(const vararg a: Int) - fun myFunction2(vararg const a: Int) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 5fc0c1bcc..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction1(const vararg a = 1) - fun myFunction2(vararg const a = 1) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index 566b4654b..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction1(const vararg a) - fun myFunction2(vararg const a) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 0eaa6ae59..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction(vararg a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest deleted file mode 100644 index 88cb12bb0..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction(vararg a: Int) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 0db9826d1..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction(vararg a = 1) -} diff --git a/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 94936d712..000000000 --- a/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - fun myFunction(vararg a) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest index 599cb0fce..ad59e6580 100644 --- a/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest @@ -4,25 +4,12 @@ class MyOuterClass { class MyClass( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index a8fae1885..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass1(const vararg a: Int = 1) - class MyClass2(vararg const a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 4e3340db5..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass1(const vararg a: Int) - class MyClass2(vararg const a: Int) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 04811e7ec..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass1(const vararg a = 1) - class MyClass2(vararg const a = 1) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index 3bc707988..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass1(const vararg a) - class MyClass2(vararg const a) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 6ef626686..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass(vararg a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest deleted file mode 100644 index e3a4c7d43..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass(vararg a: Int) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 744fd22fd..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass(vararg a = 1) -} diff --git a/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 8f0f9cb64..000000000 --- a/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class MyOuterClass { - class MyClass(vararg a) -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest index 180759e5e..274860957 100644 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest @@ -5,26 +5,13 @@ class MyClass { MyEnumVariant( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } } diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index dcb3f22cc..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,8 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a: Int = 1) - MyEnumVariant2(vararg const a: Int = 1) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter.sdstest deleted file mode 100644 index a13461748..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a: Int) - MyEnumVariant2(vararg const a: Int) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 350398740..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,8 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a = 1) - MyEnumVariant2(vararg const a = 1) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index 22dd382f1..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a) - MyEnumVariant2(vararg const a) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index a8f9f1f73..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a: Int = 1) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest deleted file mode 100644 index c2cc62905..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a: Int) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index b8ffb4c64..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a = 1) - } -} diff --git a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 7958d78d4..000000000 --- a/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a) - } -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest index 30b3bdda7..b10622e53 100644 --- a/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest @@ -4,25 +4,12 @@ enum MyEnum { MyEnumVariant( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 16993b05d..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant1(const vararg a: Int = 1) - MyEnumVariant2(vararg const a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter.sdstest deleted file mode 100644 index c2b1bb216..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant1(const vararg a: Int) - MyEnumVariant2(vararg const a: Int) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 2c868af15..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant1(const vararg a = 1) - MyEnumVariant2(vararg const a = 1) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index c49ccefda..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant1(const vararg a) - MyEnumVariant2(vararg const a) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 8109434ec..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant(vararg a: Int = 1) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest deleted file mode 100644 index 0fd1a1f6d..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant(vararg a: Int) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 6cdccf1d2..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant(vararg a = 1) -} diff --git a/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 742a3344c..000000000 --- a/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -enum MyEnum { - MyEnumVariant(vararg a) -} diff --git a/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest index 73d9b3644..e2f456605 100644 --- a/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest @@ -3,24 +3,11 @@ fun myFunction( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 240beaede..000000000 --- a/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction1(const vararg a: Int = 1) -fun myFunction2(vararg const a: Int = 1) diff --git a/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 71ba6e960..000000000 --- a/tests/resources/grammar/declarations/functions/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction1(const vararg a: Int) -fun myFunction2(vararg const a: Int) diff --git a/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 1062d11aa..000000000 --- a/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction1(const vararg a = 1) -fun myFunction2(vararg const a = 1) diff --git a/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index 14a6f4ea1..000000000 --- a/tests/resources/grammar/declarations/functions/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction1(const vararg a) -fun myFunction2(vararg const a) diff --git a/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index a5f5d73a7..000000000 --- a/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction(vararg a: Int = 1) diff --git a/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest deleted file mode 100644 index b7dc315ad..000000000 --- a/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction(vararg a: Int) diff --git a/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 2b5a7af3b..000000000 --- a/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction(vararg a = 1) diff --git a/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest deleted file mode 100644 index bb49096c5..000000000 --- a/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -fun myFunction(vararg a) diff --git a/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest b/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest index 7550d78b9..e3f868948 100644 --- a/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest +++ b/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest @@ -3,24 +3,11 @@ segment mySegment( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) {} diff --git a/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 6dd126ece..000000000 --- a/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment1(const vararg a: Int = 1) {} -segment mySegment2(vararg const a: Int = 1) {} diff --git a/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter.sdstest deleted file mode 100644 index 1b61af18b..000000000 --- a/tests/resources/grammar/declarations/segments/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment1(const vararg a: Int) {} -segment mySegment2(vararg const a: Int) {} diff --git a/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index b4be72ef8..000000000 --- a/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment1(const vararg a = 1) {} -segment mySegment2(vararg const a = 1) {} diff --git a/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index eb3cbd153..000000000 --- a/tests/resources/grammar/declarations/segments/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment1(const vararg a) {} -segment mySegment2(vararg const a) {} diff --git a/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 4402e600f..000000000 --- a/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment(vararg a: Int = 1) {} diff --git a/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest b/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest deleted file mode 100644 index 2b844d017..000000000 --- a/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment(vararg a: Int) {} diff --git a/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index d784ac69f..000000000 --- a/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment(vararg a = 1) {} diff --git a/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest deleted file mode 100644 index 024349109..000000000 --- a/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment(vararg a) {} diff --git a/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest b/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest index 46d08ccd1..669112512 100644 --- a/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest +++ b/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest @@ -4,25 +4,12 @@ pipeline myPipeline { ( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) {}; } diff --git a/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index c81ac436b..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a: Int = 1) {}; - (vararg const a: Int = 1) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter.sdstest b/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter.sdstest deleted file mode 100644 index d3bc00304..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a: Int) {}; - (vararg const a: Int) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index c493afeaf..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a = 1) {}; - (vararg const a = 1) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter.sdstest b/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter.sdstest deleted file mode 100644 index a0e83ba1a..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a) {}; - (vararg const a) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index eb0a7b515..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a: Int = 1) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest b/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest deleted file mode 100644 index 33b75c12f..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a: Int) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 3ad5cbe9d..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a = 1) {}; -} diff --git a/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest b/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest deleted file mode 100644 index bc8022588..000000000 --- a/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a) {}; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter (with default value).sdstest deleted file mode 100644 index ab35e1a7c..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a: Int = 1) -> 1; - (vararg const a: Int = 1) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter.sdstest b/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter.sdstest deleted file mode 100644 index 50c2dbce8..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a: Int) -> 1; - (vararg const a: Int) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 56a900341..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a = 1) -> 1; - (vararg const a = 1) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter.sdstest b/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter.sdstest deleted file mode 100644 index 539d77317..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (const vararg a) -> 1; - (vararg const a) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest b/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest index 9970d6f6d..2feae9f9e 100644 --- a/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest +++ b/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest @@ -4,25 +4,12 @@ pipeline myPipeline { ( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) -> 4; } diff --git a/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest deleted file mode 100644 index eb250c22e..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a: Int = 1) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest b/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest deleted file mode 100644 index 53a771e0a..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a: Int) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest deleted file mode 100644 index faa1e28a5..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a = 1) -> 1; -} diff --git a/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest b/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest deleted file mode 100644 index 7bf04b574..000000000 --- a/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - (vararg a) -> 1; -} diff --git a/tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest b/tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest deleted file mode 100644 index c36bb9ab8..000000000 --- a/tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -class vararg diff --git a/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest b/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest index 2067b68fd..10071f65a 100644 --- a/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest +++ b/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest @@ -28,6 +28,5 @@ class `super` class `true` class `union` class `val` -class `vararg` class `where` class `yield` diff --git a/tests/resources/grammar/types/callable types/good-const typed variadic parameter (with default value).sdstest b/tests/resources/grammar/types/callable types/good-const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 1aee60858..000000000 --- a/tests/resources/grammar/types/callable types/good-const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (const vararg a: Int = 1) -> (), - g: (vararg const a: Int = 1) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-const typed variadic parameter.sdstest b/tests/resources/grammar/types/callable types/good-const typed variadic parameter.sdstest deleted file mode 100644 index f12d78c43..000000000 --- a/tests/resources/grammar/types/callable types/good-const typed variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (const vararg a: Int) -> (), - g: (vararg const a: Int) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-const untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/types/callable types/good-const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index b6aa1e22f..000000000 --- a/tests/resources/grammar/types/callable types/good-const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (const vararg a = 1) -> (), - g: (vararg const a = 1) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-const untyped variadic parameter.sdstest b/tests/resources/grammar/types/callable types/good-const untyped variadic parameter.sdstest deleted file mode 100644 index fed425d67..000000000 --- a/tests/resources/grammar/types/callable types/good-const untyped variadic parameter.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (const vararg a) -> (), - g: (vararg const a) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-typed variadic parameter (with default value).sdstest b/tests/resources/grammar/types/callable types/good-typed variadic parameter (with default value).sdstest deleted file mode 100644 index 0fa1b4e5f..000000000 --- a/tests/resources/grammar/types/callable types/good-typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (vararg a: Int = 1) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-typed variadic parameter.sdstest b/tests/resources/grammar/types/callable types/good-typed variadic parameter.sdstest deleted file mode 100644 index d8e29465c..000000000 --- a/tests/resources/grammar/types/callable types/good-typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (vararg a: Int) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-untyped variadic parameter (with default value).sdstest b/tests/resources/grammar/types/callable types/good-untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 27fc9f99b..000000000 --- a/tests/resources/grammar/types/callable types/good-untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (vararg a = 1) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-untyped variadic parameter.sdstest b/tests/resources/grammar/types/callable types/good-untyped variadic parameter.sdstest deleted file mode 100644 index c676991f8..000000000 --- a/tests/resources/grammar/types/callable types/good-untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -segment mySegment( - f: (vararg a) -> () -) {} diff --git a/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest b/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest index 4636eff12..453d1caa7 100644 --- a/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest +++ b/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest @@ -4,25 +4,12 @@ segment mySegment( f: ( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, - @Annotation a2, + @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) -> () ) {} From da4e14d0d0ca7804ec352f5741d4077230bfe9ac Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:29:45 +0200 Subject: [PATCH 10/16] fix: formatter tests --- .../declarations/annotations/full.sdstest | 4 +- .../annotations/multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 9 --- ...ith const typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- ...h const untyped variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 5 -- .../with typed variadic parameter.sdstest | 5 -- ...dic parameter (with default value).sdstest | 5 -- .../with untyped variadic parameter.sdstest | 5 -- .../methods/multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 13 ----- ...ith const typed variadic parameter.sdstest | 12 ---- ...dic parameter (with default value).sdstest | 13 ----- ...h const untyped variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 9 --- .../with typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- .../with untyped variadic parameter.sdstest | 9 --- .../classes/multiple parameters.sdstest | 57 +++---------------- .../multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 13 ----- ...ith const typed variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 13 ----- ...h const untyped variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 9 --- .../with typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- .../with untyped variadic parameter.sdstest | 9 --- .../variants/multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 17 ------ ...ith const typed variadic parameter.sdstest | 17 ------ ...dic parameter (with default value).sdstest | 17 ------ ...h const untyped variadic parameter.sdstest | 17 ------ ...dic parameter (with default value).sdstest | 13 ----- .../with typed variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 13 ----- .../with untyped variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 9 --- ...ith const typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- ...h const untyped variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 5 -- .../with typed variadic parameter.sdstest | 5 -- ...dic parameter (with default value).sdstest | 5 -- .../with untyped variadic parameter.sdstest | 5 -- .../variants/multiple parameters.sdstest | 56 +++--------------- ...dic parameter (with default value).sdstest | 13 ----- ...ith const typed variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 13 ----- ...h const untyped variadic parameter.sdstest | 13 ----- ...dic parameter (with default value).sdstest | 9 --- .../with typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- .../with untyped variadic parameter.sdstest | 9 --- .../functions/multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 9 --- ...ith const typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- ...h const untyped variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 5 -- .../with typed variadic parameter.sdstest | 5 -- ...dic parameter (with default value).sdstest | 5 -- .../with untyped variadic parameter.sdstest | 5 -- .../segments/multiple parameters.sdstest | 55 +++--------------- ...dic parameter (with default value).sdstest | 9 --- ...ith const typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- ...h const untyped variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 5 -- .../with typed variadic parameter.sdstest | 5 -- ...dic parameter (with default value).sdstest | 5 -- .../with untyped variadic parameter.sdstest | 5 -- .../block lambdas/multiple parameters.sdstest | 56 +++--------------- ...dic parameter (with default value).sdstest | 11 ---- ...ith const typed variadic parameter.sdstest | 11 ---- ...dic parameter (with default value).sdstest | 11 ---- ...h const untyped variadic parameter.sdstest | 11 ---- ...dic parameter (with default value).sdstest | 9 --- .../with typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- .../with untyped variadic parameter.sdstest | 9 --- .../const typed variadic parameter.sdstest | 11 ---- .../const untyped variadic parameter.sdstest | 11 ---- .../multiple parameters.sdstest | 56 +++--------------- ...rameter (with const default value).sdstest | 11 ---- ...dic parameter (with default value).sdstest | 9 --- .../typed variadic parameter.sdstest | 9 --- ...rameter (with const default value).sdstest | 11 ---- ...dic parameter (with default value).sdstest | 9 --- .../untyped variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 11 ---- ...ith const typed variadic parameter.sdstest | 11 ---- ...dic parameter (with default value).sdstest | 11 ---- ...h const untyped variadic parameter.sdstest | 11 ---- .../with multiple parameters.sdstest | 56 +++--------------- ...dic parameter (with default value).sdstest | 9 --- .../with typed variadic parameter.sdstest | 9 --- ...dic parameter (with default value).sdstest | 9 --- .../with untyped variadic parameter.sdstest | 9 --- 100 files changed, 90 insertions(+), 1372 deletions(-) delete mode 100644 tests/resources/formatting/declarations/annotations/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with const default value).sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with const default value).sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/types/callable types/with const typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with const typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/types/callable types/with const untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with const untyped variadic parameter.sdstest delete mode 100644 tests/resources/formatting/types/callable types/with typed variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with typed variadic parameter.sdstest delete mode 100644 tests/resources/formatting/types/callable types/with untyped variadic parameter (with default value).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with untyped variadic parameter.sdstest diff --git a/tests/resources/formatting/declarations/annotations/full.sdstest b/tests/resources/formatting/declarations/annotations/full.sdstest index 2db8cb0cc..6240bd873 100644 --- a/tests/resources/formatting/declarations/annotations/full.sdstest +++ b/tests/resources/formatting/declarations/annotations/full.sdstest @@ -6,7 +6,7 @@ package test annotation MyAnnotation ( @Annotation3 a : Int , - vararg b : Int = 3 + const b : Int = 3 ) where { T2 super Number , @@ -22,7 +22,7 @@ package test annotation MyAnnotation( @Annotation3 a: Int, - vararg b: Int = 3 + const b: Int = 3 ) where { T2 super Number, T3 sub Number diff --git a/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest b/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest index df20ca8c9..ab65d410b 100644 --- a/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest @@ -4,43 +4,18 @@ annotation MyAnnotation ( b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) // ----------------------------------------------------------------------------- @@ -49,25 +24,11 @@ annotation MyAnnotation( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/formatting/declarations/annotations/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/annotations/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 3cf9ee6a0..000000000 --- a/tests/resources/formatting/declarations/annotations/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -annotation MyAnnotation1 ( const vararg a : Int = 1 ) - -annotation MyAnnotation2 ( vararg const a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation1(const vararg a: Int = 1) - -annotation MyAnnotation2(vararg const a: Int = 1) diff --git a/tests/resources/formatting/declarations/annotations/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/annotations/with const typed variadic parameter.sdstest deleted file mode 100644 index 66a958a6d..000000000 --- a/tests/resources/formatting/declarations/annotations/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -annotation MyAnnotation1 ( const vararg a : Int ) - -annotation MyAnnotation2 ( vararg const a : Int ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation1(const vararg a: Int) - -annotation MyAnnotation2(vararg const a: Int) diff --git a/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index e9466ff5e..000000000 --- a/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -annotation MyAnnotation1 ( const vararg a = 1 ) - -annotation MyAnnotation2 ( vararg const a = 1 ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation1(const vararg a = 1) - -annotation MyAnnotation2(vararg const a = 1) diff --git a/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter.sdstest deleted file mode 100644 index 862b47f26..000000000 --- a/tests/resources/formatting/declarations/annotations/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -annotation MyAnnotation1 ( const vararg a ) - -annotation MyAnnotation2 ( vararg const a ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation1(const vararg a) - -annotation MyAnnotation2(vararg const a) diff --git a/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index d4d79500c..000000000 --- a/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -annotation MyAnnotation ( vararg a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation(vararg a: Int = 1) diff --git a/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest deleted file mode 100644 index 789d7b355..000000000 --- a/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -annotation MyAnnotation ( vararg a : Int ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation(vararg a: Int) diff --git a/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 423b92fef..000000000 --- a/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -annotation MyAnnotation ( vararg a = 1 ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation(vararg a = 1) diff --git a/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest deleted file mode 100644 index 998951649..000000000 --- a/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -annotation MyAnnotation ( vararg a ) - -// ----------------------------------------------------------------------------- - -annotation MyAnnotation(vararg a) diff --git a/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest b/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest index 20cbf524a..ff5ac1d09 100644 --- a/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest @@ -5,43 +5,18 @@ class MyClass { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) } @@ -52,26 +27,12 @@ class MyClass { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 86aeeed9d..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - fun myFunction1 ( const vararg a : Int = 1 ) - - fun myFunction2 ( vararg const a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction1(const vararg a: Int = 1) - - fun myFunction2(vararg const a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter.sdstest deleted file mode 100644 index d9717e07a..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -class MyClass { - fun myFunction1 ( const vararg a : Int ) - fun myFunction2 ( vararg const a : Int ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction1(const vararg a: Int) - - fun myFunction2(vararg const a: Int) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 7948b5ddc..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - fun myFunction1 ( const vararg a = 1 ) - - fun myFunction2 ( vararg const a = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction1(const vararg a = 1) - - fun myFunction2(vararg const a = 1) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter.sdstest deleted file mode 100644 index 75a0d1be7..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - fun myFunction1 ( const vararg a ) - - fun myFunction2 ( vararg const a ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction1(const vararg a) - - fun myFunction2(vararg const a) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index b938bdbae..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass { - fun myFunction ( vararg a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction(vararg a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest deleted file mode 100644 index c13cb60dd..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass { - fun myFunction ( vararg a : Int ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction(vararg a: Int) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 80670436e..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass { - fun myFunction ( vararg a = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction(vararg a = 1) -} diff --git a/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest deleted file mode 100644 index 1c90825bd..000000000 --- a/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass { - fun myFunction ( vararg a ) -} - -// ----------------------------------------------------------------------------- - -class MyClass { - fun myFunction(vararg a) -} diff --git a/tests/resources/formatting/declarations/classes/multiple parameters.sdstest b/tests/resources/formatting/declarations/classes/multiple parameters.sdstest index 7f59bcc44..190886d25 100644 --- a/tests/resources/formatting/declarations/classes/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/classes/multiple parameters.sdstest @@ -4,44 +4,17 @@ class MyClass ( b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , - - const vararg g2 : Int , - - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 + const c2 : Int , + const d2 : Int = 2 ) // ----------------------------------------------------------------------------- @@ -50,25 +23,11 @@ class MyClass( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest b/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest index 9d6cd479f..810848414 100644 --- a/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest @@ -5,43 +5,18 @@ class MyOuterClass { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) } @@ -52,26 +27,12 @@ class MyOuterClass { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 20d6ad8ba..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyOuterClass { - class MyClass1 ( const vararg a : Int = 1 ) - - class MyClass2 ( vararg const a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass1(const vararg a: Int = 1) - - class MyClass2(vararg const a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter.sdstest deleted file mode 100644 index 2d311d22b..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyOuterClass { - class MyClass1 ( const vararg a : Int ) - - class MyClass2 ( vararg const a : Int ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass1(const vararg a: Int) - - class MyClass2(vararg const a: Int) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 45c2d3531..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyOuterClass { - class MyClass1 ( const vararg a = 1 ) - - class MyClass2 ( vararg const a = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass1(const vararg a = 1) - - class MyClass2(vararg const a = 1) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter.sdstest deleted file mode 100644 index 0b4c710f4..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyOuterClass { - class MyClass1 ( const vararg a ) - - class MyClass2 ( vararg const a ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass1(const vararg a) - - class MyClass2(vararg const a) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 4f8362e1a..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyOuterClass { - class MyClass ( vararg a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass(vararg a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest deleted file mode 100644 index 9096c9df5..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyOuterClass { - class MyClass ( vararg a : Int ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass(vararg a: Int) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 417253885..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyOuterClass { - class MyClass ( vararg a = 1 ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass(vararg a = 1) -} diff --git a/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest deleted file mode 100644 index a4f040167..000000000 --- a/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyOuterClass { - class MyClass ( vararg a ) -} - -// ----------------------------------------------------------------------------- - -class MyOuterClass { - class MyClass(vararg a) -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest index 1aeb935ae..69cc64866 100644 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest @@ -6,43 +6,18 @@ class MyClass { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) } } @@ -55,27 +30,13 @@ class MyClass { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } } diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index a4273424d..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,17 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant1 ( const vararg a : Int = 1 ) - - MyEnumVariant2 ( vararg const a : Int = 1 ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a: Int = 1) - - MyEnumVariant2(vararg const a: Int = 1) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter.sdstest deleted file mode 100644 index 6a1dd665c..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant1 ( const vararg a : Int ) - - MyEnumVariant2 ( vararg const a : Int ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a: Int) - - MyEnumVariant2(vararg const a: Int) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 3899d1ed7..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,17 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant1 ( const vararg a = 1 ) - - MyEnumVariant2 ( vararg const a = 1 ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a = 1) - - MyEnumVariant2(vararg const a = 1) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter.sdstest deleted file mode 100644 index a01e581c0..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant1 ( const vararg a ) - - MyEnumVariant2 ( vararg const a ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant1(const vararg a) - - MyEnumVariant2(vararg const a) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index a2208dcb3..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant ( vararg a : Int = 1 ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a: Int = 1) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest deleted file mode 100644 index 0545dc7fa..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant ( vararg a : Int ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a: Int) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 7a808b7c7..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant ( vararg a = 1 ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a = 1) - } -} diff --git a/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest deleted file mode 100644 index 6a6973ac4..000000000 --- a/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass { - enum MyEnum { - MyEnumVariant ( vararg a ) - } -} - -// ----------------------------------------------------------------------------- - -class MyClass { - enum MyEnum { - MyEnumVariant(vararg a) - } -} diff --git a/tests/resources/formatting/declarations/classes/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 30b8ce30f..000000000 --- a/tests/resources/formatting/declarations/classes/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass1 ( const vararg a : Int = 1 ) - -class MyClass2 ( vararg const a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -class MyClass1(const vararg a: Int = 1) - -class MyClass2(vararg const a: Int = 1) diff --git a/tests/resources/formatting/declarations/classes/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/with const typed variadic parameter.sdstest deleted file mode 100644 index 8d4d44abe..000000000 --- a/tests/resources/formatting/declarations/classes/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass1 ( const vararg a : Int ) - -class MyClass2 ( vararg const a : Int ) - -// ----------------------------------------------------------------------------- - -class MyClass1(const vararg a: Int) - -class MyClass2(vararg const a: Int) diff --git a/tests/resources/formatting/declarations/classes/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 6af6fa7a4..000000000 --- a/tests/resources/formatting/declarations/classes/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass1 ( const vararg a = 1 ) - -class MyClass2 ( vararg const a = 1 ) - -// ----------------------------------------------------------------------------- - -class MyClass1(const vararg a = 1) - -class MyClass2(vararg const a = 1) diff --git a/tests/resources/formatting/declarations/classes/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/with const untyped variadic parameter.sdstest deleted file mode 100644 index fa9d9f94e..000000000 --- a/tests/resources/formatting/declarations/classes/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -class MyClass1 ( const vararg a ) - -class MyClass2 ( vararg const a ) - -// ----------------------------------------------------------------------------- - -class MyClass1(const vararg a) - -class MyClass2(vararg const a) diff --git a/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index a05a5eae6..000000000 --- a/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class MyClass ( vararg a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -class MyClass(vararg a: Int = 1) diff --git a/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest deleted file mode 100644 index 1df3e13ca..000000000 --- a/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class MyClass ( vararg a : Int ) - -// ----------------------------------------------------------------------------- - -class MyClass(vararg a: Int) diff --git a/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 742ca1d20..000000000 --- a/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class MyClass ( vararg a = 1 ) - -// ----------------------------------------------------------------------------- - -class MyClass(vararg a = 1) diff --git a/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest deleted file mode 100644 index de5cbea73..000000000 --- a/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class MyClass ( vararg a ) - -// ----------------------------------------------------------------------------- - -class MyClass(vararg a) diff --git a/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest b/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest index 9a1f0a452..a2dfec9ec 100644 --- a/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest @@ -5,43 +5,17 @@ enum MyEnum { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , - - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 + const d2 : Int = 2 ) } @@ -53,26 +27,12 @@ enum MyEnum { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) } diff --git a/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 8472d2a40..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -enum MyEnum { - MyEnumVariant1 ( const vararg a : Int = 1 ) - - MyEnumVariant2 ( vararg const a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant1(const vararg a: Int = 1) - - MyEnumVariant2(vararg const a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter.sdstest deleted file mode 100644 index 987e211ab..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -enum MyEnum { - MyEnumVariant1 ( const vararg a : Int ) - - MyEnumVariant2 ( vararg const a : Int ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant1(const vararg a: Int) - - MyEnumVariant2(vararg const a: Int) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 601cd9f19..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,13 +0,0 @@ -enum MyEnum { - MyEnumVariant1 (const vararg a = 1 ) - - MyEnumVariant2 (vararg const a = 1 ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant1(const vararg a = 1) - - MyEnumVariant2(vararg const a = 1) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter.sdstest deleted file mode 100644 index b4cd44b1c..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -enum MyEnum { - MyEnumVariant1 ( const vararg a ) - - MyEnumVariant2 ( vararg const a ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant1(const vararg a) - - MyEnumVariant2(vararg const a) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index a0ec0c970..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum MyEnum { - MyEnumVariant ( vararg a : Int = 1 ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant(vararg a: Int = 1) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest deleted file mode 100644 index e61188a82..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum MyEnum { - MyEnumVariant ( vararg a : Int ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant(vararg a: Int) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 6d4fa2a96..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum MyEnum { - MyEnumVariant (vararg a = 1 ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant(vararg a = 1) -} diff --git a/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest deleted file mode 100644 index 0eb53e36a..000000000 --- a/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum MyEnum { - MyEnumVariant ( vararg a ) -} - -// ----------------------------------------------------------------------------- - -enum MyEnum { - MyEnumVariant(vararg a) -} diff --git a/tests/resources/formatting/declarations/functions/multiple parameters.sdstest b/tests/resources/formatting/declarations/functions/multiple parameters.sdstest index acfeb8d16..0645897d2 100644 --- a/tests/resources/formatting/declarations/functions/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/functions/multiple parameters.sdstest @@ -4,43 +4,18 @@ fun myFunction ( b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) // ----------------------------------------------------------------------------- @@ -49,25 +24,11 @@ fun myFunction( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) diff --git a/tests/resources/formatting/declarations/functions/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/functions/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index b1e03ed3c..000000000 --- a/tests/resources/formatting/declarations/functions/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -fun myFunction1 ( const vararg a : Int = 1 ) - -fun myFunction2 ( vararg const a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -fun myFunction1(const vararg a: Int = 1) - -fun myFunction2(vararg const a: Int = 1) diff --git a/tests/resources/formatting/declarations/functions/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/functions/with const typed variadic parameter.sdstest deleted file mode 100644 index 582d02671..000000000 --- a/tests/resources/formatting/declarations/functions/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -fun myFunction1 ( const vararg a : Int ) - -fun myFunction2 ( vararg const a : Int ) - -// ----------------------------------------------------------------------------- - -fun myFunction1(const vararg a: Int) - -fun myFunction2(vararg const a: Int) diff --git a/tests/resources/formatting/declarations/functions/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/functions/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 489f10e75..000000000 --- a/tests/resources/formatting/declarations/functions/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -fun myFunction1 ( const vararg a = 1 ) - -fun myFunction2 ( vararg const a = 1 ) - -// ----------------------------------------------------------------------------- - -fun myFunction1(const vararg a = 1) - -fun myFunction2(vararg const a = 1) diff --git a/tests/resources/formatting/declarations/functions/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/functions/with const untyped variadic parameter.sdstest deleted file mode 100644 index 212fff051..000000000 --- a/tests/resources/formatting/declarations/functions/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -fun myFunction1 ( const vararg a ) - -fun myFunction2 ( vararg const a ) - -// ----------------------------------------------------------------------------- - -fun myFunction1(const vararg a) - -fun myFunction2(vararg const a) diff --git a/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 2c5b6b9a7..000000000 --- a/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun myFunction ( vararg a : Int = 1 ) - -// ----------------------------------------------------------------------------- - -fun myFunction(vararg a: Int = 1) diff --git a/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest deleted file mode 100644 index e2ed6cffb..000000000 --- a/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun myFunction ( vararg a : Int ) - -// ----------------------------------------------------------------------------- - -fun myFunction(vararg a: Int) diff --git a/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index c88ff43de..000000000 --- a/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun myFunction ( vararg a = 1 ) - -// ----------------------------------------------------------------------------- - -fun myFunction(vararg a = 1) diff --git a/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest deleted file mode 100644 index 3d6fae2c5..000000000 --- a/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun myFunction ( vararg a ) - -// ----------------------------------------------------------------------------- - -fun myFunction(vararg a) diff --git a/tests/resources/formatting/declarations/segments/multiple parameters.sdstest b/tests/resources/formatting/declarations/segments/multiple parameters.sdstest index 8365dbb24..ad06a581b 100644 --- a/tests/resources/formatting/declarations/segments/multiple parameters.sdstest +++ b/tests/resources/formatting/declarations/segments/multiple parameters.sdstest @@ -4,43 +4,18 @@ segment mySegment ( b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , + const d2 : Int = 2 - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 ) { } // ----------------------------------------------------------------------------- @@ -49,25 +24,11 @@ segment mySegment( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) {} diff --git a/tests/resources/formatting/declarations/segments/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/segments/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 8e73ddba6..000000000 --- a/tests/resources/formatting/declarations/segments/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment1 ( const vararg a : Int = 1 ) { } - -segment mySegment2 ( vararg const a : Int = 1 ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment1(const vararg a: Int = 1) {} - -segment mySegment2(vararg const a: Int = 1) {} diff --git a/tests/resources/formatting/declarations/segments/with const typed variadic parameter.sdstest b/tests/resources/formatting/declarations/segments/with const typed variadic parameter.sdstest deleted file mode 100644 index 326ddf817..000000000 --- a/tests/resources/formatting/declarations/segments/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment1 ( const vararg a : Int ) { } - -segment mySegment2 ( vararg const a : Int ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment1(const vararg a: Int) {} - -segment mySegment2(vararg const a: Int) {} diff --git a/tests/resources/formatting/declarations/segments/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/segments/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index f6584a258..000000000 --- a/tests/resources/formatting/declarations/segments/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment1 ( const vararg a = 1 ) { } - -segment mySegment2 ( vararg const a = 1 ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment1(const vararg a = 1) {} - -segment mySegment2(vararg const a = 1) {} diff --git a/tests/resources/formatting/declarations/segments/with const untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/segments/with const untyped variadic parameter.sdstest deleted file mode 100644 index 4c06127a3..000000000 --- a/tests/resources/formatting/declarations/segments/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment1 ( const vararg a ) { } - -segment mySegment2 ( vararg const a ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment1(const vararg a) {} - -segment mySegment2(vararg const a) {} diff --git a/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 51cff7374..000000000 --- a/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment mySegment ( vararg a : Int = 1 ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment(vararg a: Int = 1) {} diff --git a/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest b/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest deleted file mode 100644 index 69ef43188..000000000 --- a/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment mySegment ( vararg a : Int ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment(vararg a: Int) {} diff --git a/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 0ee3cffd8..000000000 --- a/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment mySegment ( vararg a = 1 ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment(vararg a = 1) {} diff --git a/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest b/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest deleted file mode 100644 index 111740490..000000000 --- a/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment mySegment ( vararg a ) { } - -// ----------------------------------------------------------------------------- - -segment mySegment(vararg a) {} diff --git a/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest b/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest index 3d9a4b36c..8095bf9c8 100644 --- a/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest +++ b/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest @@ -5,43 +5,17 @@ pipeline myPipeline { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , - - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 + const d2 : Int = 2 ) { }; } @@ -53,26 +27,12 @@ pipeline myPipeline { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) {}; } diff --git a/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index d6ec28c44..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a : Int = 1 ) { }; - ( vararg const a : Int = 1 ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a: Int = 1) {}; - (vararg const a: Int = 1) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter.sdstest b/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter.sdstest deleted file mode 100644 index ae439e03b..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a : Int ) { }; - ( vararg const a : Int ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a: Int) {}; - (vararg const a: Int) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index cbe42f209..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a = 1 ) { }; - ( vararg const a = 1 ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a = 1) {}; - (vararg const a = 1) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter.sdstest b/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter.sdstest deleted file mode 100644 index 8242d435f..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a ) { }; - ( vararg const a ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a) {}; - (vararg const a) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 9d2adadea..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a : Int = 1 ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a: Int = 1) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest b/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest deleted file mode 100644 index 2c6111a39..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a : Int ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a: Int) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index fa0340f01..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a = 1 ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a = 1) {}; -} diff --git a/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest b/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest deleted file mode 100644 index 65b5c91fe..000000000 --- a/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a ) { }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a) {}; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/const typed variadic parameter.sdstest b/tests/resources/formatting/expressions/expression lambdas/const typed variadic parameter.sdstest deleted file mode 100644 index 7ee6c993d..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/const typed variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a : Int ) -> 1; - ( vararg const a : Int ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a: Int) -> 1; - (vararg const a: Int) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/const untyped variadic parameter.sdstest b/tests/resources/formatting/expressions/expression lambdas/const untyped variadic parameter.sdstest deleted file mode 100644 index 1646dada6..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/const untyped variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a ) -> 1; - ( vararg const a ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a) -> 1; - (vararg const a) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest b/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest index b4c6f3f07..1ee6e5ef9 100644 --- a/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest +++ b/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest @@ -5,43 +5,17 @@ pipeline myPipeline { b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , - - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 + const d2 : Int = 2 ) -> 4; } @@ -53,26 +27,12 @@ pipeline myPipeline { @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) -> 4; } diff --git a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with const default value).sdstest b/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with const default value).sdstest deleted file mode 100644 index d354b1033..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with const default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a : Int = 1 ) -> 1; - ( vararg const a : Int = 1 ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a: Int = 1) -> 1; - (vararg const a: Int = 1) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest deleted file mode 100644 index b0ad6f272..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a : Int = 1 ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a: Int = 1) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest b/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest deleted file mode 100644 index 17e57f8bc..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a : Int ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a: Int) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with const default value).sdstest b/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with const default value).sdstest deleted file mode 100644 index 27d205750..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with const default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - ( const vararg a = 1 ) -> 1; - ( vararg const a = 1 ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (const vararg a = 1) -> 1; - (vararg const a = 1) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest deleted file mode 100644 index 91c5a9b78..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a = 1 ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a = 1) -> 1; -} diff --git a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest b/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest deleted file mode 100644 index ae0c6e22b..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - ( vararg a ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (vararg a) -> 1; -} diff --git a/tests/resources/formatting/types/callable types/with const typed variadic parameter (with default value).sdstest b/tests/resources/formatting/types/callable types/with const typed variadic parameter (with default value).sdstest deleted file mode 100644 index 314d9de52..000000000 --- a/tests/resources/formatting/types/callable types/with const typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment mySegment( - f: ( const vararg a : Int = 1 ) -> ( ), - g: ( vararg const a : Int = 1 ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (const vararg a: Int = 1) -> (), - g: (vararg const a: Int = 1) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with const typed variadic parameter.sdstest b/tests/resources/formatting/types/callable types/with const typed variadic parameter.sdstest deleted file mode 100644 index 8573c773f..000000000 --- a/tests/resources/formatting/types/callable types/with const typed variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment mySegment( - f: ( const vararg a : Int ) -> ( ), - g: ( vararg const a : Int ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (const vararg a: Int) -> (), - g: (vararg const a: Int) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with const untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/types/callable types/with const untyped variadic parameter (with default value).sdstest deleted file mode 100644 index c05d2a2f2..000000000 --- a/tests/resources/formatting/types/callable types/with const untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment mySegment( - f: ( const vararg a = 1 ) -> ( ), - g: ( vararg const a = 1 ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (const vararg a = 1) -> (), - g: (vararg const a = 1) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with const untyped variadic parameter.sdstest b/tests/resources/formatting/types/callable types/with const untyped variadic parameter.sdstest deleted file mode 100644 index 21688048e..000000000 --- a/tests/resources/formatting/types/callable types/with const untyped variadic parameter.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment mySegment( - f: ( const vararg a ) -> ( ), - g: ( vararg const a ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (const vararg a) -> (), - g: (vararg const a) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with multiple parameters.sdstest b/tests/resources/formatting/types/callable types/with multiple parameters.sdstest index ddc505033..2c4eabc5f 100644 --- a/tests/resources/formatting/types/callable types/with multiple parameters.sdstest +++ b/tests/resources/formatting/types/callable types/with multiple parameters.sdstest @@ -5,43 +5,17 @@ segment mySegment( b1 = 0 , - vararg c1 , + c1 : Int , - vararg d1 : Int = 1 , - - e1 : Int , - - f1 : Int = 2 , - - vararg g1 : Int , - - vararg h1 : Int = 3 , + d1 : Int = 2 , @Annotation const a2 , const b2 = 0 , - const vararg c2 , - - const vararg d2 : Int = 1 , - - const e2 : Int , - - const f2 : Int = 2 , + const c2 : Int , - const vararg g2 : Int , - - const vararg h2 : Int = 3 , - -@Annotation vararg const a3 , - - vararg const c3 , - - vararg const d3 : Int = 1 , - - vararg const g3 : Int , - - vararg const h3 : Int = 3 + const d2 : Int = 2 ) -> ( ) ) {} @@ -53,26 +27,12 @@ segment mySegment( @Annotation a1, b1 = 0, - vararg c1, - vararg d1: Int = 1, - e1: Int, - f1: Int = 2, - vararg g1: Int, - vararg h1: Int = 3, + c1: Int, + d1: Int = 2, @Annotation const a2, const b2 = 0, - const vararg c2, - const vararg d2: Int = 1, - const e2: Int, - const f2: Int = 2, - const vararg g2: Int, - const vararg h2: Int = 3, - @Annotation - vararg const a3, - vararg const c3, - vararg const d3: Int = 1, - vararg const g3: Int, - vararg const h3: Int = 3 + const c2: Int, + const d2: Int = 2 ) -> () ) {} diff --git a/tests/resources/formatting/types/callable types/with typed variadic parameter (with default value).sdstest b/tests/resources/formatting/types/callable types/with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 646221917..000000000 --- a/tests/resources/formatting/types/callable types/with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment( - f: ( vararg a : Int = 1 ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (vararg a: Int = 1) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with typed variadic parameter.sdstest b/tests/resources/formatting/types/callable types/with typed variadic parameter.sdstest deleted file mode 100644 index a31d40a0d..000000000 --- a/tests/resources/formatting/types/callable types/with typed variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment( - f: ( vararg a : Int ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (vararg a: Int) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with untyped variadic parameter (with default value).sdstest b/tests/resources/formatting/types/callable types/with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index d817dfde9..000000000 --- a/tests/resources/formatting/types/callable types/with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment( - f: ( vararg a = 1 ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (vararg a = 1) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with untyped variadic parameter.sdstest b/tests/resources/formatting/types/callable types/with untyped variadic parameter.sdstest deleted file mode 100644 index 832e79dd7..000000000 --- a/tests/resources/formatting/types/callable types/with untyped variadic parameter.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment mySegment( - f: ( vararg a ) -> ( ) -) {} - -// ----------------------------------------------------------------------------- - -segment mySegment( - f: (vararg a) -> () -) {} From 1f09273a9e490b611a22c39f540a18f397d7bc18 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:31:33 +0200 Subject: [PATCH 11/16] fix: tests for `argumentToParameterOrUndefined` --- .../argumentToParameterOrUndefined.test.ts | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/language/helpers/safe-ds-node-mapper/argumentToParameterOrUndefined.test.ts b/tests/language/helpers/safe-ds-node-mapper/argumentToParameterOrUndefined.test.ts index 844a1315d..216cc68b4 100644 --- a/tests/language/helpers/safe-ds-node-mapper/argumentToParameterOrUndefined.test.ts +++ b/tests/language/helpers/safe-ds-node-mapper/argumentToParameterOrUndefined.test.ts @@ -52,7 +52,7 @@ describe('SafeDsNodeMapper', () => { describe('positional argument', () => { it('should return the parameter at the same index if all prior arguments are positional', async () => { const code = ` - fun f(p1: Int = 0, vararg p2: Int, p3: Int) {} + fun f(p1: Int = 0, p2: Int, p3: Int) {} pipeline myPipeline { f(1, 2, 3); @@ -66,7 +66,7 @@ describe('SafeDsNodeMapper', () => { it('should return undefined if a prior argument is named', async () => { const code = ` - fun f(p1: Int = 0, vararg p2: Int, p3: Int) {} + fun f(p1: Int = 0, p2: Int, p3: Int) {} pipeline myPipeline { f(p2 = 1, 2, 3); @@ -78,9 +78,9 @@ describe('SafeDsNodeMapper', () => { expect(parameterNames).toStrictEqual(['p2', undefined, undefined]); }); - it('should return undefined if argument is out of bounds and there is no final variadic parameter', async () => { + it('should return undefined if argument is out of bounds', async () => { const code = ` - fun f(vararg p1: Int, p2: Int) {} + fun f(p1: Int, p2: Int) {} pipeline myPipeline { f(1, 2, 3); @@ -91,20 +91,6 @@ describe('SafeDsNodeMapper', () => { const parameterNames = argumentsOrEmpty(call).map(parameterNameOrNull); expect(parameterNames).toStrictEqual(['p1', 'p2', undefined]); }); - - it('should return return the final variadic parameter if argument is out of bounds', async () => { - const code = ` - fun f(p1: Int, p2: Int = 0, vararg p3: Int) {} - - pipeline myPipeline { - f(1, 2, 3, 4, 5); - } - `; - - const call = await getNodeOfType(services, code, isSdsAbstractCall); - const parameterNames = argumentsOrEmpty(call).map(parameterNameOrNull); - expect(parameterNames).toStrictEqual(['p1', 'p2', 'p3', 'p3', 'p3']); - }); }); const parameterNameOrNull = (node: SdsArgument): string | undefined => { From fce6ca2abf845fa30bafc1279ee6307afcca138f Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:32:37 +0200 Subject: [PATCH 12/16] fix: scoping tests --- .../arguments/of annotation calls/to parameter/main.sdstest | 2 +- .../arguments/of calls/to parameter of annotation/main.sdstest | 2 +- .../of calls/to parameter of block lambda/main.sdstest | 2 +- .../of calls/to parameter of callable type/main.sdstest | 2 +- .../arguments/of calls/to parameter of class/main.sdstest | 2 +- .../of calls/to parameter of enum variant/main.sdstest | 2 +- .../of calls/to parameter of expression lambda/main.sdstest | 2 +- .../arguments/of calls/to parameter of function/main.sdstest | 2 +- .../arguments/of calls/to parameter of segment/main.sdstest | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/resources/scoping/arguments/of annotation calls/to parameter/main.sdstest b/tests/resources/scoping/arguments/of annotation calls/to parameter/main.sdstest index 3fa6c7e51..f718a1e60 100644 --- a/tests/resources/scoping/arguments/of annotation calls/to parameter/main.sdstest +++ b/tests/resources/scoping/arguments/of annotation calls/to parameter/main.sdstest @@ -6,7 +6,7 @@ annotation MyAnnotation( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) @MyAnnotation( diff --git a/tests/resources/scoping/arguments/of calls/to parameter of annotation/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of annotation/main.sdstest index 6bafc607a..97bfa9ed1 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of annotation/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of annotation/main.sdstest @@ -6,7 +6,7 @@ annotation MyAnnotation( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) pipeline myPipeline { diff --git a/tests/resources/scoping/arguments/of calls/to parameter of block lambda/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of block lambda/main.sdstest index 30d60c9a7..0d1c6bf41 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of block lambda/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of block lambda/main.sdstest @@ -7,7 +7,7 @@ pipeline myPipeline { // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) {}; myBlockLambda( diff --git a/tests/resources/scoping/arguments/of calls/to parameter of callable type/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of callable type/main.sdstest index d01a3622b..686269333 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of callable type/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of callable type/main.sdstest @@ -6,7 +6,7 @@ segment mySegment(myCallableType: ( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) -> ()) { myCallableType( // $TEST$ references c diff --git a/tests/resources/scoping/arguments/of calls/to parameter of class/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of class/main.sdstest index 9d2493ae4..179e03539 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of class/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of class/main.sdstest @@ -6,7 +6,7 @@ class MyClass( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) {} pipeline myPipeline { diff --git a/tests/resources/scoping/arguments/of calls/to parameter of enum variant/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of enum variant/main.sdstest index 5bb626e9a..bcc2d952b 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of enum variant/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of enum variant/main.sdstest @@ -7,7 +7,7 @@ enum MyEnum { // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) } diff --git a/tests/resources/scoping/arguments/of calls/to parameter of expression lambda/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of expression lambda/main.sdstest index 0a62f23e1..79ce806f7 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of expression lambda/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of expression lambda/main.sdstest @@ -7,7 +7,7 @@ pipeline myPipeline { // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) -> 1; myExpressionLambda( diff --git a/tests/resources/scoping/arguments/of calls/to parameter of function/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of function/main.sdstest index 9f9f4f632..73a81bc8b 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of function/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of function/main.sdstest @@ -6,7 +6,7 @@ fun myFunction( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) pipeline myPipeline { diff --git a/tests/resources/scoping/arguments/of calls/to parameter of segment/main.sdstest b/tests/resources/scoping/arguments/of calls/to parameter of segment/main.sdstest index c31352a55..e4957c077 100644 --- a/tests/resources/scoping/arguments/of calls/to parameter of segment/main.sdstest +++ b/tests/resources/scoping/arguments/of calls/to parameter of segment/main.sdstest @@ -6,7 +6,7 @@ segment mySegment( // $TEST$ target b »b«: Int = 0, // $TEST$ target c - vararg »c«: Int + »c«: Int ) {} pipeline myPipeline { From f8c741e29ce80b5bc39495e4fc69e7f14956b240 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:35:17 +0200 Subject: [PATCH 13/16] fix: typing tests --- .../declarations/parameters/of annotations/main.sdstest | 5 +---- .../of block lambdas/with manifest types/main.sdstest | 3 --- .../declarations/parameters/of callable types/main.sdstest | 5 +---- .../typing/declarations/parameters/of classes/main.sdstest | 5 +---- .../declarations/parameters/of enum variants/main.sdstest | 5 +---- .../of expression lambdas/with manifest types/main.sdstest | 3 --- .../typing/declarations/parameters/of functions/main.sdstest | 5 +---- .../typing/declarations/parameters/of segments/main.sdstest | 5 +---- .../block lambdas/with manifest types/main.sdstest | 4 ++-- .../expression lambdas/with manifest types/main.sdstest | 3 --- 10 files changed, 8 insertions(+), 35 deletions(-) diff --git a/tests/resources/typing/declarations/parameters/of annotations/main.sdstest b/tests/resources/typing/declarations/parameters/of annotations/main.sdstest index ebf0930ae..7b408d03b 100644 --- a/tests/resources/typing/declarations/parameters/of annotations/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of annotations/main.sdstest @@ -4,8 +4,5 @@ package tests.typing.declarations.parameters.ofAnnotations // $TEST$ equivalence_class parameterType annotation MyAnnotation1(»p«: »Int«) -// $TEST$ serialization vararg -annotation MyAnnotation2(vararg »p«: String) - // $TEST$ serialization $Unknown -annotation MyAnnotation3(»p«) +annotation MyAnnotation2(»p«) diff --git a/tests/resources/typing/declarations/parameters/of block lambdas/with manifest types/main.sdstest b/tests/resources/typing/declarations/parameters/of block lambdas/with manifest types/main.sdstest index 0ebc10a70..4b0564d6a 100644 --- a/tests/resources/typing/declarations/parameters/of block lambdas/with manifest types/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of block lambdas/with manifest types/main.sdstest @@ -4,7 +4,4 @@ segment mySegment() { // $TEST$ equivalence_class parameterType3 // $TEST$ equivalence_class parameterType3 (»p«: »Int«) {}; - - // $TEST$ serialization vararg - (vararg »p«: String) {}; } diff --git a/tests/resources/typing/declarations/parameters/of callable types/main.sdstest b/tests/resources/typing/declarations/parameters/of callable types/main.sdstest index 716f12cb9..486ca65c8 100644 --- a/tests/resources/typing/declarations/parameters/of callable types/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of callable types/main.sdstest @@ -4,8 +4,5 @@ package tests.typing.declarations.parameters.ofCallableTypes // $TEST$ equivalence_class parameterType annotation MyAnnotation1(f: (»p«: »Int«) -> ()) -// $TEST$ serialization vararg -annotation MyAnnotation2(f: (vararg »p«: String) -> ()) - // $TEST$ serialization $Unknown -annotation MyAnnotation3(f: (»p«) -> ()) +annotation MyAnnotation2(f: (»p«) -> ()) diff --git a/tests/resources/typing/declarations/parameters/of classes/main.sdstest b/tests/resources/typing/declarations/parameters/of classes/main.sdstest index 1ad48613e..84616dbcb 100644 --- a/tests/resources/typing/declarations/parameters/of classes/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of classes/main.sdstest @@ -4,8 +4,5 @@ package tests.typing.declarations.parameters.ofClasses // $TEST$ equivalence_class parameterType class MyClass1(»p«: »Int«) -// $TEST$ serialization vararg -class MyClass2(vararg »p«: String) - // $TEST$ serialization $Unknown -class MyClass3(»p«) +class MyClass2(»p«) diff --git a/tests/resources/typing/declarations/parameters/of enum variants/main.sdstest b/tests/resources/typing/declarations/parameters/of enum variants/main.sdstest index 208ce02a5..f670c3a49 100644 --- a/tests/resources/typing/declarations/parameters/of enum variants/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of enum variants/main.sdstest @@ -5,9 +5,6 @@ enum MyEnum { // $TEST$ equivalence_class parameterType MyEnumVariant1(»p«: »Int«) - // $TEST$ serialization vararg - MyEnumVariant2(vararg »p«: String) - // $TEST$ serialization $Unknown - MyEnumVariant3(»p«) + MyEnumVariant2(»p«) } diff --git a/tests/resources/typing/declarations/parameters/of expression lambdas/with manifest types/main.sdstest b/tests/resources/typing/declarations/parameters/of expression lambdas/with manifest types/main.sdstest index 43a583f96..216895176 100644 --- a/tests/resources/typing/declarations/parameters/of expression lambdas/with manifest types/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of expression lambdas/with manifest types/main.sdstest @@ -4,7 +4,4 @@ segment mySegment() { // $TEST$ equivalence_class parameterType3 // $TEST$ equivalence_class parameterType3 (»p«: »Int«) -> 1; - - // $TEST$ serialization vararg - (vararg »p«: String) -> 1; } diff --git a/tests/resources/typing/declarations/parameters/of functions/main.sdstest b/tests/resources/typing/declarations/parameters/of functions/main.sdstest index 2374778db..512a718a5 100644 --- a/tests/resources/typing/declarations/parameters/of functions/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of functions/main.sdstest @@ -4,8 +4,5 @@ package tests.typing.declarations.parameters.ofFunctions // $TEST$ equivalence_class parameterType fun myFunction1(»p«: »Int«) -// $TEST$ serialization vararg -fun myFunction2(vararg »p«: String) - // $TEST$ serialization $Unknown -fun myFunction3(»p«) +fun myFunction2(»p«) diff --git a/tests/resources/typing/declarations/parameters/of segments/main.sdstest b/tests/resources/typing/declarations/parameters/of segments/main.sdstest index 25e9217d6..3fa6f9735 100644 --- a/tests/resources/typing/declarations/parameters/of segments/main.sdstest +++ b/tests/resources/typing/declarations/parameters/of segments/main.sdstest @@ -4,8 +4,5 @@ package tests.typing.declarations.parameters.ofSegments // $TEST$ equivalence_class parameterType segment mySegment1(»p«: »Int«) {} -// $TEST$ serialization vararg -segment mySegment2(vararg »p«: String) {} - // $TEST$ serialization $Unknown -segment mySegment3(»p«) {} +segment mySegment2(»p«) {} diff --git a/tests/resources/typing/expressions/block lambdas/with manifest types/main.sdstest b/tests/resources/typing/expressions/block lambdas/with manifest types/main.sdstest index 958dc4df9..226f243a7 100644 --- a/tests/resources/typing/expressions/block lambdas/with manifest types/main.sdstest +++ b/tests/resources/typing/expressions/block lambdas/with manifest types/main.sdstest @@ -7,8 +7,8 @@ segment mySegment() { yield s = ""; }«; - // $TEST$ serialization (p: vararg) -> (r: Int, s: $Unknown) - »(vararg p: String) { + // $TEST$ serialization (p: String) -> (r: Int, s: $Unknown) + »(p: String) { yield r, yield s = 1; }«; } diff --git a/tests/resources/typing/expressions/expression lambdas/with manifest types/main.sdstest b/tests/resources/typing/expressions/expression lambdas/with manifest types/main.sdstest index fa754edb3..8052f703c 100644 --- a/tests/resources/typing/expressions/expression lambdas/with manifest types/main.sdstest +++ b/tests/resources/typing/expressions/expression lambdas/with manifest types/main.sdstest @@ -3,7 +3,4 @@ package tests.typing.expressions.expressionLambdas.withManifestTypes segment mySegment() { // $TEST$ serialization (p: Int) -> (result: Int) »(p: Int) -> 1«; - - // $TEST$ serialization (p: vararg) -> (result: Int) - »(vararg p: String) -> 1«; } From 49062265fc2e4cfaf0904cd5c5e368184daaa572 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:39:48 +0200 Subject: [PATCH 14/16] fix: validation tests --- .../main.sdstest | 4 +- .../main.sdstest | 24 +-- .../main.sdstest | 142 ------------------ .../variadic must be last/main.sdstest | 118 --------------- .../main.sdstest | 12 -- .../variadic optional.sdstest | 8 - .../variadic required.sdstest | 8 - .../main.sdstest | 2 +- .../main.sdstest | 2 +- 9 files changed, 12 insertions(+), 308 deletions(-) delete mode 100644 tests/resources/validation/other/declarations/parameter lists/must not mix optional and variadic/main.sdstest delete mode 100644 tests/resources/validation/other/declarations/parameter lists/variadic must be last/main.sdstest delete mode 100644 tests/resources/validation/other/declarations/parameters/variadic must not be optional/main.sdstest delete mode 100644 tests/resources/validation/other/types/callable types/must not have optional parameters/variadic optional.sdstest delete mode 100644 tests/resources/validation/other/types/callable types/must not have optional parameters/variadic required.sdstest diff --git a/tests/resources/validation/other/argument lists/must not have positional argument after named argument/main.sdstest b/tests/resources/validation/other/argument lists/must not have positional argument after named argument/main.sdstest index 234cd6572..62634ca30 100644 --- a/tests/resources/validation/other/argument lists/must not have positional argument after named argument/main.sdstest +++ b/tests/resources/validation/other/argument lists/must not have positional argument after named argument/main.sdstest @@ -1,6 +1,6 @@ package tests.validation.other.argumentLists.mustNotHavePositionalArgumentAfterNamedArgument -annotation MyAnnotation(a: Int, b: Int = 0, c: Int = 0, d: Int = 0, vararg e: Int) +annotation MyAnnotation(a: Int, b: Int = 0, c: Int = 0, d: Int = 0) // $TEST$ no error "After the first named argument all arguments must be named." // $TEST$ no error "After the first named argument all arguments must be named." @@ -33,7 +33,7 @@ class MyClass5 @UnresolvedAnnotation(»a = 0«) class MyClass3 -fun f(a: Int, b: Int = 0, c: Int = 0, d: Int = 0, vararg e: Int) +fun f(a: Int, b: Int = 0, c: Int = 0, d: Int = 0) pipeline myPipeline { // $TEST$ no error "After the first named argument all arguments must be named." diff --git a/tests/resources/validation/other/declarations/parameter lists/must not have required after optional/main.sdstest b/tests/resources/validation/other/declarations/parameter lists/must not have required after optional/main.sdstest index 86560eea1..41c667611 100644 --- a/tests/resources/validation/other/declarations/parameter lists/must not have required after optional/main.sdstest +++ b/tests/resources/validation/other/declarations/parameter lists/must not have required after optional/main.sdstest @@ -4,8 +4,7 @@ package tests.validation.other.declarations.parameterLists.mustNotHaveRequiredAf // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." -// $TEST$ no error "After the first optional parameter all parameters must be optional." -annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) +annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -19,8 +18,7 @@ annotation MyAnnotation3(»a«: Int) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." -// $TEST$ no error "After the first optional parameter all parameters must be optional." -class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) +class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -35,8 +33,7 @@ enum MyEnum { // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." - // $TEST$ no error "After the first optional parameter all parameters must be optional." - MyEnumVariant1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) + MyEnumVariant1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -51,8 +48,7 @@ enum MyEnum { // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." -// $TEST$ no error "After the first optional parameter all parameters must be optional." -fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) +fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -66,8 +62,7 @@ fun myFunction3(»a«: Int) // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." -// $TEST$ no error "After the first optional parameter all parameters must be optional." -segment mySegment1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {} +segment mySegment1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) {} // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -82,8 +77,7 @@ pipeline myPipeline { // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." - // $TEST$ no error "After the first optional parameter all parameters must be optional." - (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {}; + (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) {}; // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -97,8 +91,7 @@ pipeline myPipeline { // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." - // $TEST$ no error "After the first optional parameter all parameters must be optional." - (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> 1; + (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) -> 1; // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." @@ -114,8 +107,7 @@ fun myFunction4( // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." - // $TEST$ no error "After the first optional parameter all parameters must be optional." - p1: (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> (), + p1: (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2) -> (), // $TEST$ no error "After the first optional parameter all parameters must be optional." // $TEST$ no error "After the first optional parameter all parameters must be optional." diff --git a/tests/resources/validation/other/declarations/parameter lists/must not mix optional and variadic/main.sdstest b/tests/resources/validation/other/declarations/parameter lists/must not mix optional and variadic/main.sdstest deleted file mode 100644 index d497fd3ff..000000000 --- a/tests/resources/validation/other/declarations/parameter lists/must not mix optional and variadic/main.sdstest +++ /dev/null @@ -1,142 +0,0 @@ -package tests.validation.other.declarations.parameterLists.mustNotMixOptionalAndVariadic - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -annotation MyAnnotation2(»a«: Int, vararg »b«: Int = 1) - -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -annotation MyAnnotation3(vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) - - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -class MyClass2(»a«: Int, vararg »b«: Int = 1) - -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -class MyClass3(vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) - - -enum MyEnum { - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - MyEnumVariant1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - MyEnumVariant2(»a«: Int, vararg »b«: Int = 1) - - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - MyEnumVariant3(vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) -} - - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -fun myFunction2(»a«: Int, vararg »b«: Int = 1) - -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -fun myFunction3(vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) - - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -segment mySegment1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {} - -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -segment mySegment2(»a«: Int, vararg »b«: Int = 1) {} - -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ no error "A callable with optional parameters must not have a variadic parameter." -// $TEST$ error "A callable with optional parameters must not have a variadic parameter." -segment mySegment3(vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) {} - - -pipeline myPipeline { - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {}; - - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - (»a«: Int, vararg »b«: Int = 1) {}; - - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - (vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) {}; - - - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> 1; - - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - (»a«: Int, vararg »b«: Int = 1) -> 1; - - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - (vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) -> 1; -} - - -fun myFunction4( - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - p1: (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> (), - - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - p2: (»a«: Int, vararg »b«: Int = 1) -> (), - - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ no error "A callable with optional parameters must not have a variadic parameter." - // $TEST$ error "A callable with optional parameters must not have a variadic parameter." - p3: (vararg »a«: Int, »b«: Int = 1, vararg »c«: Int) -> (), -) diff --git a/tests/resources/validation/other/declarations/parameter lists/variadic must be last/main.sdstest b/tests/resources/validation/other/declarations/parameter lists/variadic must be last/main.sdstest deleted file mode 100644 index a286a5616..000000000 --- a/tests/resources/validation/other/declarations/parameter lists/variadic must be last/main.sdstest +++ /dev/null @@ -1,118 +0,0 @@ -package tests.validation.other.declarations.parameterLists.variadicMustBeLast - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -annotation MyAnnotation1(»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -annotation MyAnnotation2(»a«: Int, »b«: Int = 1, vararg »c«: Int) - - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -class MyClass1(»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -class MyClass2(»a«: Int, »b«: Int = 1, vararg »c«: Int) - - -enum MyEnum { - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - MyEnumVariant1(»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) - - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - MyEnumVariant2(»a«: Int, »b«: Int = 1, vararg »c«: Int) -} - - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -fun myFunction1(»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -fun myFunction2(»a«: Int, »b«: Int = 1, vararg »c«: Int) - - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -// $TEST$ error "After a variadic parameter no more parameters must be specified." -segment mySegment1(»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) {} - -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -// $TEST$ no error "After a variadic parameter no more parameters must be specified." -segment mySegment2(»a«: Int, »b«: Int = 1, vararg »c«: Int) {} - - -pipeline myPipeline { - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - (»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) {}; - - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - (»a«: Int, »b«: Int = 1, vararg »c«: Int) {}; - - - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - (»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) -> 1; - - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - (»a«: Int, »b«: Int = 1, vararg »c«: Int) -> 1; -} - - -fun myFunction3( - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - // $TEST$ error "After a variadic parameter no more parameters must be specified." - p1: (»a«: Int, »b«: Int = 1, vararg »c«: Int, »d«: Int, »e«: Int = 1, vararg »f«: Int) -> (), - - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - // $TEST$ no error "After a variadic parameter no more parameters must be specified." - p2: (»a«: Int, »b«: Int = 1, vararg »c«: Int) -> (), -) diff --git a/tests/resources/validation/other/declarations/parameters/variadic must not be optional/main.sdstest b/tests/resources/validation/other/declarations/parameters/variadic must not be optional/main.sdstest deleted file mode 100644 index ae90eaae3..000000000 --- a/tests/resources/validation/other/declarations/parameters/variadic must not be optional/main.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.parameters.variadicMustNotBeOptional - -fun f( - // $TEST$ no error "Variadic parameters must not be optional." - »a«: Int, - // $TEST$ no error "Variadic parameters must not be optional." - »b«: Int = 1, - // $TEST$ no error "Variadic parameters must not be optional." - vararg »c«: Int, - // $TEST$ error "Variadic parameters must not be optional." - vararg »d«: Int = 2 -) diff --git a/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic optional.sdstest b/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic optional.sdstest deleted file mode 100644 index 267ae8215..000000000 --- a/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic optional.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.validation.other.types.callableTypes.mustNotHaveOptionalParameters - -fun f( - g: ( - // $TEST$ no error "A callable type must not have optional parameters." - vararg p: Int = 1, - ) -> () -) diff --git a/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic required.sdstest b/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic required.sdstest deleted file mode 100644 index 268a73697..000000000 --- a/tests/resources/validation/other/types/callable types/must not have optional parameters/variadic required.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.validation.types.other.callableTypes.mustNotHaveOptionalParameters - -fun f( - g: ( - // $TEST$ no error "A callable type must not have optional parameters." - vararg p: Int, - ) -> () -) diff --git a/tests/resources/validation/style/unnecessary argument list in annotation call/main.sdstest b/tests/resources/validation/style/unnecessary argument list in annotation call/main.sdstest index 8ec279c73..9889671f3 100644 --- a/tests/resources/validation/style/unnecessary argument list in annotation call/main.sdstest +++ b/tests/resources/validation/style/unnecessary argument list in annotation call/main.sdstest @@ -7,7 +7,7 @@ annotation AnnotationWithoutParameterList annotation AnnotationWithEmptyParameterList() @Repeatable -annotation AnnotationWithoutRequiredParameters(a: Int = 0, vararg b: Int) +annotation AnnotationWithoutRequiredParameters(a: Int = 0) @Repeatable annotation AnnotationWithRequiredParameters(a: Int) diff --git a/tests/resources/validation/style/unnecessary argument list in call/main.sdstest b/tests/resources/validation/style/unnecessary argument list in call/main.sdstest index 3c3eb3615..c4abf0856 100644 --- a/tests/resources/validation/style/unnecessary argument list in call/main.sdstest +++ b/tests/resources/validation/style/unnecessary argument list in call/main.sdstest @@ -7,7 +7,7 @@ class MyClass() enum MyEnum { EnumVariantWithoutParameterList EnumVariantWithEmptyParameterList() - EnumVariantWithoutRequiredParameters(a: Int = 0, vararg b: Int) + EnumVariantWithoutRequiredParameters(a: Int = 0) EnumVariantWithRequiredParameters(a: Int) } From 79a35261aa4b9643c8ebc46d92e8c8c6f2dc1592 Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:44:51 +0000 Subject: [PATCH 15/16] style: apply automated linter fixes --- src/language/validation/safe-ds-validator.ts | 4 +--- tests/helpers/diagnostics.ts | 10 ++++++++-- tests/helpers/testChecks.ts | 12 ++++++------ tests/helpers/testDescription.ts | 2 +- tests/language/validation/creator.ts | 14 ++++++++++---- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/language/validation/safe-ds-validator.ts b/src/language/validation/safe-ds-validator.ts index 43629e25b..ab77827e5 100644 --- a/src/language/validation/safe-ds-validator.ts +++ b/src/language/validation/safe-ds-validator.ts @@ -116,9 +116,7 @@ export const registerValidationChecks = function (services: SafeDsServices) { namedTypeTypeArgumentListShouldBeNeeded, ], SdsParameter: [parameterMustHaveTypeHint], - SdsParameterList: [ - parameterListMustNotHaveRequiredParametersAfterOptionalParameters, - ], + SdsParameterList: [parameterListMustNotHaveRequiredParametersAfterOptionalParameters], SdsPipeline: [pipelineMustContainUniqueNames], SdsPlaceholder: [placeholderShouldBeUsed(services)], SdsReference: [ diff --git a/tests/helpers/diagnostics.ts b/tests/helpers/diagnostics.ts index c733726a0..07bc5d3ce 100644 --- a/tests/helpers/diagnostics.ts +++ b/tests/helpers/diagnostics.ts @@ -61,7 +61,10 @@ const getDiagnostics = async (services: LangiumServices, code: string): Promise< * The code contains syntax errors. */ export class SyntaxErrorsInCodeError extends TestDescriptionError { - constructor(readonly syntaxErrors: Diagnostic[], uri: URI) { + constructor( + readonly syntaxErrors: Diagnostic[], + uri: URI, + ) { const syntaxErrorsAsString = syntaxErrors.map((e) => ` - ${e.message}`).join(`\n`); super(`Code has syntax errors:\n${syntaxErrorsAsString}`, uri); @@ -72,7 +75,10 @@ export class SyntaxErrorsInCodeError extends TestDescriptionError { * The code contains syntax errors. */ export class ErrorsInCodeError extends TestDescriptionError { - constructor(readonly errors: Diagnostic[], uri: URI) { + constructor( + readonly errors: Diagnostic[], + uri: URI, + ) { const syntaxErrorsAsString = errors.map((e) => ` - ${e.message}`).join(`\n`); super(`Code has errors:\n${syntaxErrorsAsString}`, uri); diff --git a/tests/helpers/testChecks.ts b/tests/helpers/testChecks.ts index 56711b5ec..d9bbc2ae1 100644 --- a/tests/helpers/testChecks.ts +++ b/tests/helpers/testChecks.ts @@ -1,9 +1,9 @@ -import {Location, Range} from 'vscode-languageserver'; -import {findTestComments} from './testComments.js'; -import {findTestRanges, FindTestRangesError} from './testRanges.js'; -import {Result} from 'true-myth'; -import {URI} from 'langium'; -import {TestDescriptionError} from './testDescription.js'; +import { Location, Range } from 'vscode-languageserver'; +import { findTestComments } from './testComments.js'; +import { findTestRanges, FindTestRangesError } from './testRanges.js'; +import { Result } from 'true-myth'; +import { URI } from 'langium'; +import { TestDescriptionError } from './testDescription.js'; /** * Finds all test checks, i.e. test comments and their corresponding test ranges. diff --git a/tests/helpers/testDescription.ts b/tests/helpers/testDescription.ts index aac6a5558..2d5a5b4af 100644 --- a/tests/helpers/testDescription.ts +++ b/tests/helpers/testDescription.ts @@ -1,4 +1,4 @@ -import {URI} from "langium"; +import { URI } from 'langium'; /** * A description of a test. This interface should be extended to describe tests of specific components. diff --git a/tests/language/validation/creator.ts b/tests/language/validation/creator.ts index 99fbf6812..545bb58b1 100644 --- a/tests/language/validation/creator.ts +++ b/tests/language/validation/creator.ts @@ -1,11 +1,11 @@ import { listSafeDsFilesGroupedByParentDirectory, uriToShortenedResourceName } from '../../helpers/testResources.js'; import fs from 'fs'; import { findTestChecks } from '../../helpers/testChecks.js'; -import {getSyntaxErrors, SyntaxErrorsInCodeError} from '../../helpers/diagnostics.js'; +import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js'; import { EmptyFileSystem, URI } from 'langium'; import { createSafeDsServices } from '../../../src/language/safe-ds-module.js'; import { Range } from 'vscode-languageserver-types'; -import {TestDescription, TestDescriptionError} from '../../helpers/testDescription.js'; +import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; const services = createSafeDsServices(EmptyFileSystem).SafeDs; const rootResourceName = 'validation'; @@ -161,7 +161,10 @@ export type Severity = (typeof validSeverities)[number]; * A test comment did not match the expected format. */ class InvalidCommentError extends TestDescriptionError { - constructor(readonly comment: string, uri: URI) { + constructor( + readonly comment: string, + uri: URI, + ) { super(`Invalid test comment (refer to the documentation for guidance): ${comment}`, uri); } } @@ -170,7 +173,10 @@ class InvalidCommentError extends TestDescriptionError { * A test comment did not specify a valid severity. */ class InvalidSeverityError extends TestDescriptionError { - constructor(readonly type: string, uri: URI) { + constructor( + readonly type: string, + uri: URI, + ) { super(`Invalid severity (valid values are ${validSeverities.join(', ')}): ${type}`, uri); } } From 4d7dd80f6e0d683c1d969da3fa3b6ccf455f7186 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 9 Oct 2023 11:52:58 +0200 Subject: [PATCH 16/16] docs: update documentation --- docs/language/common/parameters.md | 47 +++---------------- docs/language/common/variance.md | 2 +- .../language/pipeline-language/expressions.md | 16 +++---- docs/stdlib/safeds_lang.md | 2 +- 4 files changed, 15 insertions(+), 52 deletions(-) diff --git a/docs/language/common/parameters.md b/docs/language/common/parameters.md index 15308aecd..89f673292 100644 --- a/docs/language/common/parameters.md +++ b/docs/language/common/parameters.md @@ -2,9 +2,8 @@ _Parameters_ define the expected inputs of some declaration that can be [called][calls]. We refer to such declarations as _callables_. We distinguish between -- [required parameters](#required-parameters), which must always be passed, -- [optional parameters](#optional-parameters), which use a default value if no value is passed explicitly, and -- [variadic parameters](#variadic-parameters), which can accept zero or more values. +- [required parameters](#required-parameters), which must always be passed, and +- [optional parameters](#optional-parameters), which use a default value if no value is passed explicitly. ## Required Parameters @@ -36,21 +35,6 @@ These are the syntactic elements: - An equals sign. - The default value of the parameter (here `1`). This must be a constant expression, i.e. something that can be evaluated by the compiler. Particularly [calls][calls] usually do not fulfill this requirement. -## Variadic Parameters - -_Variadic parameters_ can consume arbitrarily many [arguments][calls]. Here is an example: - -```txt -vararg variadicParameter: Int -``` - -Let us break down the syntax: - -- The keyword `vararg` -- The name of the parameter (here `variadicParameter`). This can be any combination of upper- and lowercase letters, underscores, and numbers, as long as it does not start with a number. However, we suggest to use `lowerCamelCase` for the names of parameters. -- A colon. -- The [type][types] of the parameter (here `Int`). - ## Complete Example Let us now look at a full example of a [segment][segments] called `doSomething` with one [required parameter](#required-parameters) and one [optional parameter](#optional-parameters): @@ -72,8 +56,6 @@ The interesting part is the list of parameters, which uses the following syntact Several restrictions apply to the order of parameters and to combinations of the various categories of parameters: - After an [optional parameter](#optional-parameters) all parameters must be optional. -- A single [variadic parameter](#variadic-parameters) can be added at the end of the parameter list. -- Implied by this: A callable cannot have both [optional parameters](#optional-parameters) and [variadic parameters](#variadic-parameters). ## Corresponding Python Code @@ -83,7 +65,7 @@ Parameters must be ordered the same way in Python as they are in Safe-DS. Moreov - Name - Type -- Kind (required vs. optional vs. variadic) +- Optionality (required vs. optional) - Default value for optional parameters Let's look at these elements in turn. @@ -114,19 +96,17 @@ In this case, the Safe-DS parameters `xPred` and `xTest` refer to the Python par The Safe-DS type of a parameter should capture the legal values of this parameter accurately. Ideally, the Python parameter should also have a matching [type hint][types-python]. -### Matching Kind +### Matching Optionality Parameters kinds must match on the Safe-DS and Python sides as well. Concretely, this means: - All required parameters in Safe-DS must be required in Python. - All optional parameters in Safe-DS must be optional in Python. -- All variadic parameters in Safe-DS must be variadic in Python (`*args`). Moreover, it must be possible to pass -- required parameters by position, -- optional parameters by name, -- variadic parameters by position. +- required parameters by position, and +- optional parameters by name. These rules allow us to restrict required parameters to [positional-only][python-positional-only] or optional parameters to [keyword-only][python-keyword-only]. We can also keep both unrestricted. @@ -162,21 +142,6 @@ def optional(a: int = 1): fun optional(a: Int = 1) ``` -#### Variadic Parameter - -```py -# Python code - -def variadic(*a: int): - pass -``` - -```txt -// Safe-DS code - -fun variadic(vararg a: Int) -``` - ### Matching Default Value Most commonly, default values in Python are literals, since default values are only evaluated once in Python rather than every time the function is called. The following table shows how Safe-DS literals and Python literals correspond: diff --git a/docs/language/common/variance.md b/docs/language/common/variance.md index 3934b3d73..72638536a 100644 --- a/docs/language/common/variance.md +++ b/docs/language/common/variance.md @@ -5,7 +5,7 @@ Variance deals with the question, which generic types are compatible with each other. We explain this concept using the following [class][classes]: ```txt -class Stack(vararg initialElements: T) { +class Stack(initialElements: List) { fun push(element: T) fun pop() -> element: T diff --git a/docs/language/pipeline-language/expressions.md b/docs/language/pipeline-language/expressions.md index 5a19a7f09..47ef048f8 100644 --- a/docs/language/pipeline-language/expressions.md +++ b/docs/language/pipeline-language/expressions.md @@ -219,7 +219,6 @@ There are some restriction regarding the choice of positional vs. named argument - For all [parameters][parameters] of the callee there must be at most one argument. - For all [required parameters][required-parameters] there must be exactly one argument. - After a named argument all arguments must be named. -- [Variadic parameters][variadic-parameters] can only be assigned by position. ### Legal Callees @@ -402,17 +401,17 @@ createValueWrapper() ## Indexed Accesses -An indexed access is currently only used to access one value assigned to a [variadic parameter][variadic-parameters]. In the following example, we use an index access to retrieve the first value that is assigned to the [variadic parameter][variadic-parameters] `values` of the segment `printFirst`: +An indexed access is currently only used to access elements of a list or values of a map by their key. In the following example, we use an index access to retrieve the first element of the `values` list: ```txt -segment printFirst(vararg values: Int) { +segment printFirst(values: List) { print(values[0]); } ``` These are the elements of the syntax: -- The name of the variadic parameter (here `values`). +- An expression that evaluates to a list or map (here the [reference](#references) `values`). - An opening square bracket. - The index, which is an expression that evaluates to an integer. The first element has index 0. - A closing square bracket. @@ -434,16 +433,16 @@ This is a [class][classes] `LinearRegression`, which has a constructor and an in We can then use those declarations in a [segment][segments]: ```txt -segment mySegment(vararg regressions: LinearRegression) { +segment mySegment(regressions: List) { regressions[0].drawAsGraph(); } ``` -This segment is called `mySegment` and has a [variadic parameter][variadic-parameters] `regressions` of type `LinearRegression`. This means we can pass an arbitrary number of instances of `LinearRegression` to the segment when we [call](#calls) it. +This segment is called `mySegment` and has a [parameter][parameters] `regressions` of type `List`. In the body of the segment we then -1. access the first instance that was pass using an [indexed access](#indexed-accesses), +1. access the first instance in the list using an [indexed access](#indexed-accesses), 2. access the instance method `drawAsGraph` of this instance using a [member access](#member-accesses), 3. [call](#calls) this method. @@ -456,7 +455,7 @@ class IntList { fun filter(filterFunction: (element: Int) -> shouldKeep: Boolean) -> filteredList: IntList } -fun intListOf(vararg elements: Int) -> result: IntList +fun intListOf(elements: List) -> result: IntList ``` First, we declare a [class][classes] `IntList`, which has a single [method][methods] called `filter`. The `filter` method returns a single result called `filteredList`, which is a new `IntList`. `filteredList` is supposed to only contain the elements of the receiving `IntList` for which the `filterFunction` [parameter][parameters] returns `true`. @@ -566,7 +565,6 @@ If the default precedence of operators is not sufficient, parentheses can be use [packages]: ../common/packages.md [parameters]: ../common/parameters.md [required-parameters]: ../common/parameters.md#required-parameters -[variadic-parameters]: ../common/parameters.md#variadic-parameters [results]: ../common/results.md [types]: ../common/types.md [callable-types]: ../common/types.md#callable-types diff --git a/docs/stdlib/safeds_lang.md b/docs/stdlib/safeds_lang.md index 4f98b5827..3856130d2 100644 --- a/docs/stdlib/safeds_lang.md +++ b/docs/stdlib/safeds_lang.md @@ -283,7 +283,7 @@ The annotation can target these declaration types. If the @Target annotation is **Parameters:** -* `vararg targets: AnnotationTarget` - The valid targets. +* `targets: List` - The valid targets. **Valid targets:**