From 3e88f029f1fad44f4cddbc72bb0a0e0b07eecdb0 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 29 Sep 2023 13:53:38 +0200 Subject: [PATCH] feat: remove type arguments from calls (#581) ### Summary of Changes Calls no longer have a type argument list. Since all objects we expose are assumed to be immutable, there is no reason to specify the type arguments of a call. We can always infer them from the parameters or set them to `Any`/`Nothing` if the parameters don't provide enough information. An added benefit of this is that our grammar now only requires a finite lookahead. --- src/language/formatting/safe-ds-formatter.ts | 1 - src/language/grammar/safe-ds.langium | 45 +++---------------- .../complex argument list (unchanged).sdstest | 11 ----- ...complex parameter list (unchanged).sdstest | 11 ----- ...complex parameter list (unchanged).sdstest | 11 ----- ...ng type parameter list (unchanged).sdstest | 15 ------- ...complex parameter list (unchanged).sdstest | 15 ------- ...ng type parameter list (unchanged).sdstest | 19 -------- ...complex parameter list (unchanged).sdstest | 11 ----- .../complex result list (unchanged).sdstest | 11 ----- ...ng type parameter list (unchanged).sdstest | 15 ------- ...complex parameter list (unchanged).sdstest | 11 ----- .../complex result list (unchanged).sdstest | 11 ----- ...complex parameter list (unchanged).sdstest | 15 ------- .../complex argument list (unchanged).sdstest | 15 ------- .../expressions/calls/complex call.sdstest | 9 ---- .../calls/contravariant type argument.sdstest | 9 ---- .../calls/covariant type argument.sdstest | 9 ---- ...ype argument list and no arguments.sdstest | 9 ---- ...ed positional and named arguments.sdstest} | 4 +- .../calls/named type argument.sdstest | 9 ---- ...gument lists (named type argument).sdstest | 9 ---- ...arguments.sdstest => no arguments.sdstest} | 0 ...t lists (positional type argument).sdstest | 41 ----------------- .../expressions/calls/star projection.sdstest | 9 ---- .../less than vs. type argument list.sdstest | 9 ---- ...complex parameter list (unchanged).sdstest | 15 ------- ...onCall.sdstest => annotation call.sdstest} | 0 ...ist of annotation call (unchanged).sdstest | 5 --- .../argument list of call (unchanged).sdstest | 9 ---- ...ter list of annotation (unchanged).sdstest | 5 --- ...r list of block lambda (unchanged).sdstest | 9 ---- ... list of callable type (unchanged).sdstest | 9 ---- ...arameter list of class (unchanged).sdstest | 5 --- ...r list of enum variant (unchanged).sdstest | 9 ---- ...t of expression lambda (unchanged).sdstest | 9 ---- ...meter list of function (unchanged).sdstest | 5 --- ...ameter list of segment (unchanged).sdstest | 5 --- ... list of callable type (unchanged).sdstest | 9 ---- ...esult list of function (unchanged).sdstest | 5 --- ...result list of segment (unchanged).sdstest | 5 --- ... argument list of call (unchanged).sdstest | 9 ---- .../type argument list of call.sdstest | 9 ---- ...arameter list of class (unchanged).sdstest | 5 --- ...r list of enum variant (unchanged).sdstest | 9 ---- ...meter list of function (unchanged).sdstest | 5 --- ...complex parameter list (unchanged).sdstest | 16 ------- ...th complex result list (unchanged).sdstest | 15 ------- .../bad-unclosed type argument list.sdstest | 5 --- .../calls/good-complex call.sdstest | 5 --- .../good-contravariant type argument.sdstest | 5 --- .../good-covariant type argument.sdstest | 5 --- ...ed positional and named arguments.sdstest} | 2 +- ...ed type argument with test markers.sdstest | 5 --- .../calls/good-named type argument.sdstest | 5 --- ...gument lists (named type argument).sdstest | 5 --- ...ents.sdstest => good-no arguments.sdstest} | 0 ...l type argument with tests markers.sdstest | 5 --- .../good-positional type argument.sdstest | 5 --- .../calls/good-star projection.sdstest | 5 --- ...t lists (positional type argument).sdstest | 21 --------- ...d-less than vs. type argument list.sdstest | 6 --- .../good-type argument list of call.sdstest | 5 --- .../main.sdstest | 14 ------ 64 files changed, 9 insertions(+), 595 deletions(-) delete mode 100644 tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest delete mode 100644 tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest delete mode 100644 tests/resources/formatting/expressions/calls/complex call.sdstest delete mode 100644 tests/resources/formatting/expressions/calls/contravariant type argument.sdstest delete mode 100644 tests/resources/formatting/expressions/calls/covariant type argument.sdstest delete mode 100644 tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest rename tests/resources/formatting/expressions/calls/{positional type argument.sdstest => mixed positional and named arguments.sdstest} (75%) delete mode 100644 tests/resources/formatting/expressions/calls/named type argument.sdstest delete mode 100644 tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest rename tests/resources/formatting/expressions/calls/{no type argument list and no arguments.sdstest => no arguments.sdstest} (100%) delete mode 100644 tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest delete mode 100644 tests/resources/formatting/expressions/calls/star projection.sdstest delete mode 100644 tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest delete mode 100644 tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest rename tests/resources/formatting/schema/{annotationCall.sdstest => annotation call.sdstest} (100%) delete mode 100644 tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/type argument list of call.sdstest delete mode 100644 tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest delete mode 100644 tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest delete mode 100644 tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest delete mode 100644 tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-complex call.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest rename tests/resources/grammar/expressions/calls/{good-empty type argument list and no arguments.sdstest => good-mixed positional and named arguments.sdstest} (75%) delete mode 100644 tests/resources/grammar/expressions/calls/good-named type argument with test markers.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-named type argument.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest rename tests/resources/grammar/expressions/calls/{good-no type argument list and no arguments.sdstest => good-no arguments.sdstest} (100%) delete mode 100644 tests/resources/grammar/expressions/calls/good-positional type argument with tests markers.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-positional type argument.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/good-star projection.sdstest delete mode 100644 tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest delete mode 100644 tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest delete mode 100644 tests/resources/grammar/trailing commas/good-type argument list of call.sdstest diff --git a/src/language/formatting/safe-ds-formatter.ts b/src/language/formatting/safe-ds-formatter.ts index 15400bcdf..e016302a9 100644 --- a/src/language/formatting/safe-ds-formatter.ts +++ b/src/language/formatting/safe-ds-formatter.ts @@ -678,7 +678,6 @@ export class SafeDsFormatter extends AbstractFormatter { private formatSdsCall(node: ast.SdsCall) { const formatter = this.getNodeFormatter(node); - formatter.property('typeArgumentList').prepend(noSpace()); formatter.property('argumentList').prepend(noSpace()); } diff --git a/src/language/grammar/safe-ds.langium b/src/language/grammar/safe-ds.langium index 425197a1c..c3185e1f1 100644 --- a/src/language/grammar/safe-ds.langium +++ b/src/language/grammar/safe-ds.langium @@ -597,7 +597,7 @@ SdsComparisonExpression returns SdsExpression: ; SdsComparisonOperator returns string: - LESS_THAN | '<=' | '>=' | '>' + '<' | '<=' | '>=' | '>' ; SdsAdditiveExpression returns SdsExpression: @@ -644,9 +644,7 @@ interface SdsChainedExpression extends SdsExpression { receiver: SdsExpression } -interface SdsCall extends SdsAbstractCall, SdsChainedExpression { - typeArgumentList?: SdsTypeArgumentList -} +interface SdsCall extends SdsAbstractCall, SdsChainedExpression {} interface SdsIndexedAccess extends SdsChainedExpression { index: SdsExpression @@ -661,7 +659,6 @@ SdsChainedExpression returns SdsExpression: SdsPrimaryExpression ( {SdsCall.receiver=current} - typeArgumentList=SdsCallTypeArgumentList? argumentList=SdsCallArgumentList | {SdsIndexedAccess.receiver=current} @@ -856,7 +853,7 @@ interface SdsLiteralList extends SdsObject { SdsLiteralList returns SdsLiteralList: {SdsLiteralList} - (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + '<' ( literals+=SdsLiteral (',' literals+=SdsLiteral)* @@ -887,7 +884,7 @@ SdsUnionType returns SdsUnionType: SdsUnionTypeArgumentList returns SdsTypeArgumentList: {SdsTypeArgumentList} - (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + '<' ( typeArguments+=SdsUnionTypeArgument (',' typeArguments+=SdsUnionTypeArgument)* @@ -914,7 +911,7 @@ interface SdsTypeParameterList extends SdsObject { SdsTypeParameterList returns SdsTypeParameterList: {SdsTypeParameterList} - (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + '<' ( typeParameters+=SdsTypeParameter (',' typeParameters+=SdsTypeParameter)* @@ -943,14 +940,7 @@ interface SdsTypeArgumentList extends SdsObject { SdsTypeArgumentList returns SdsTypeArgumentList: {SdsTypeArgumentList} - (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) - (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument)* ','? )? - '>' -; - -SdsCallTypeArgumentList returns SdsTypeArgumentList: - {SdsTypeArgumentList} - CALL_TYPE_ARGUMENT_LIST_START + '<' (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument)* ','? )? '>' ; @@ -1040,29 +1030,6 @@ terminal TEMPLATE_STRING_START returns string: STRING_START STRING_TEXT* TEMPLAT terminal TEMPLATE_STRING_INNER returns string: TEMPLATE_EXPRESSION_END STRING_TEXT* TEMPLATE_EXPRESSION_START; terminal TEMPLATE_STRING_END returns string: TEMPLATE_EXPRESSION_END STRING_TEXT* STRING_END; -// Resolves the ambiguity between the less than operator (<) and the start of a type argument list of a call (<). -// See also: https://github.com/langium/langium/discussions/921#discussioncomment-4943180 -terminal CALL_TYPE_ARGUMENT_LIST_START: - '<' - (?= - /[\s»«]*/ - ( '*' // Star projection as positional type argument - | 'in' // Contravariant type projection as positional type argument - | 'out' // Covariant type projection as positional type argument - | 'literal' // Invariant literal type as positional type argument - | 'union' // Invariant union type as positional type argument - | '>' // Empty type argument list - | ID /[\s»«]*/ - ( '=' // Named type argument - | ('.' /[\s»«]*/ ID /[\s»«]*/)* (',' | '>') // Invariant type projection as positional type argument - ) - ) - ) -; -terminal LESS_THAN: - '<' -; - hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//; hidden terminal SL_COMMENT: /\/\/[^\n\r]*/; hidden terminal TEST_MARKER: /[»«]/; diff --git a/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest b/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest deleted file mode 100644 index 6d69262d6..000000000 --- a/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -@A( - f(), - 2 -) - -// ----------------------------------------------------------------------------- - -@A( - f(), - 2 -) diff --git a/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest deleted file mode 100644 index d597db58e..000000000 --- a/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -annotation A( - a: A.B, - b: Int -) - -// ----------------------------------------------------------------------------- - -annotation A( - a: A.B, - b: Int -) diff --git a/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest deleted file mode 100644 index 311595c15..000000000 --- a/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -class C( - a: A.B, - b: Int -) - -// ----------------------------------------------------------------------------- - -class C( - a: A.B, - b: Int -) diff --git a/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest deleted file mode 100644 index 9082a2494..000000000 --- a/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -class C< - K, - V, - X, - Y -> - -// ----------------------------------------------------------------------------- - -class C< - K, - V, - X, - Y -> diff --git a/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest deleted file mode 100644 index 1552b4e76..000000000 --- a/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -enum E { - A( - a: A.B, - b: Int - ) -} - -// ----------------------------------------------------------------------------- - -enum E { - A( - a: A.B, - b: Int - ) -} diff --git a/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest deleted file mode 100644 index f4f44b314..000000000 --- a/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest +++ /dev/null @@ -1,19 +0,0 @@ -enum E { - A< - K, - V, - X, - Y - > -} - -// ----------------------------------------------------------------------------- - -enum E { - A< - K, - V, - X, - Y - > -} diff --git a/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest deleted file mode 100644 index 7b7db9fd3..000000000 --- a/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -fun f( - a: A.B, - b: Int -) - -// ----------------------------------------------------------------------------- - -fun f( - a: A.B, - b: Int -) diff --git a/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest b/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest deleted file mode 100644 index f3328934b..000000000 --- a/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -fun f() -> ( - x: A.B, - y: Int -) - -// ----------------------------------------------------------------------------- - -fun f() -> ( - x: A.B, - y: Int -) diff --git a/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest deleted file mode 100644 index bd0d55562..000000000 --- a/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -fun f< - K, - V, - X, - Y ->() - -// ----------------------------------------------------------------------------- - -fun f< - K, - V, - X, - Y ->() diff --git a/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest b/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest deleted file mode 100644 index 105f30c51..000000000 --- a/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment s( - a: A.B, - b: Int -) {} - -// ----------------------------------------------------------------------------- - -segment s( - a: A.B, - b: Int -) {} diff --git a/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest b/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest deleted file mode 100644 index b91176007..000000000 --- a/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest +++ /dev/null @@ -1,11 +0,0 @@ -segment s() -> ( - x: A.B, - y: Int -) {} - -// ----------------------------------------------------------------------------- - -segment s() -> ( - x: A.B, - y: Int -) {} diff --git a/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest b/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest deleted file mode 100644 index f0af1ad3a..000000000 --- a/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -pipeline p { - ( - a: A.B, - b: Int - ) {}; -} - -// ----------------------------------------------------------------------------- - -pipeline p { - ( - a: A.B, - b: Int - ) {}; -} diff --git a/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest b/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest deleted file mode 100644 index bf4f30fce..000000000 --- a/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -pipeline p { - f( - f(), - 2 - ); -} - -// ----------------------------------------------------------------------------- - -pipeline p { - f( - f(), - 2 - ); -} diff --git a/tests/resources/formatting/expressions/calls/complex call.sdstest b/tests/resources/formatting/expressions/calls/complex call.sdstest deleted file mode 100644 index 7b50db792..000000000 --- a/tests/resources/formatting/expressions/calls/complex call.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < * , in Number , out Number , T = Number > ( 1 , b = 2 ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f<*, in Number, out Number, T = Number>(1, b = 2); -} diff --git a/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest b/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest deleted file mode 100644 index d429c4fd9..000000000 --- a/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < in Int > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/formatting/expressions/calls/covariant type argument.sdstest b/tests/resources/formatting/expressions/calls/covariant type argument.sdstest deleted file mode 100644 index 755fcfe8d..000000000 --- a/tests/resources/formatting/expressions/calls/covariant type argument.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < out Int > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest b/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest deleted file mode 100644 index 62ad87be7..000000000 --- a/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f<>(); -} diff --git a/tests/resources/formatting/expressions/calls/positional type argument.sdstest b/tests/resources/formatting/expressions/calls/mixed positional and named arguments.sdstest similarity index 75% rename from tests/resources/formatting/expressions/calls/positional type argument.sdstest rename to tests/resources/formatting/expressions/calls/mixed positional and named arguments.sdstest index 8eb1593ca..9c51ecc94 100644 --- a/tests/resources/formatting/expressions/calls/positional type argument.sdstest +++ b/tests/resources/formatting/expressions/calls/mixed positional and named arguments.sdstest @@ -1,9 +1,9 @@ pipeline myPipeline { - f < Int > ( ); + f ( 1 , b = 2 ); } // ----------------------------------------------------------------------------- pipeline myPipeline { - f(); + f(1, b = 2); } diff --git a/tests/resources/formatting/expressions/calls/named type argument.sdstest b/tests/resources/formatting/expressions/calls/named type argument.sdstest deleted file mode 100644 index 80d0f3be5..000000000 --- a/tests/resources/formatting/expressions/calls/named type argument.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < T = Int > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest b/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest deleted file mode 100644 index d89d28d64..000000000 --- a/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < T = List < S > > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f>(); -} diff --git a/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest b/tests/resources/formatting/expressions/calls/no arguments.sdstest similarity index 100% rename from tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest rename to tests/resources/formatting/expressions/calls/no arguments.sdstest diff --git a/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest b/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest deleted file mode 100644 index d30be06a3..000000000 --- a/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest +++ /dev/null @@ -1,41 +0,0 @@ -pipeline myPipeline { - /* - * Once Langium supports LL(*) parsing, this should work. - * - * For now, we can either parse - * - f>() or - * - a < f() - * but not both. - * - * The problem is that the parser can't decide with finite lookahead whether - * the first < is the start of a type argument list or the operator of a - * comparison expression. - * - * We decided to only support the second case for now. The first case leads - * to a syntax error. To work around this, you can use the following syntax: - * - f>() - */ - f>(); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - /* - * Once Langium supports LL(*) parsing, this should work. - * - * For now, we can either parse - * - f>() or - * - a < f() - * but not both. - * - * The problem is that the parser can't decide with finite lookahead whether - * the first < is the start of a type argument list or the operator of a - * comparison expression. - * - * We decided to only support the second case for now. The first case leads - * to a syntax error. To work around this, you can use the following syntax: - * - f>() - */ - f>(); -} diff --git a/tests/resources/formatting/expressions/calls/star projection.sdstest b/tests/resources/formatting/expressions/calls/star projection.sdstest deleted file mode 100644 index 0ed8577a9..000000000 --- a/tests/resources/formatting/expressions/calls/star projection.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - f < * > ( ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f<*>(); -} diff --git a/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest b/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest deleted file mode 100644 index a22882b23..000000000 --- a/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - 1 < a(); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - 1 < a(); -} diff --git a/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest b/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest deleted file mode 100644 index 3bf86f912..000000000 --- a/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -pipeline p { - ( - a: A.B, - b: Int - ) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline p { - ( - a: A.B, - b: Int - ) -> 1; -} diff --git a/tests/resources/formatting/schema/annotationCall.sdstest b/tests/resources/formatting/schema/annotation call.sdstest similarity index 100% rename from tests/resources/formatting/schema/annotationCall.sdstest rename to tests/resources/formatting/schema/annotation call.sdstest diff --git a/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest b/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest deleted file mode 100644 index 073b2004f..000000000 --- a/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -@A(1, 2,) - -// ----------------------------------------------------------------------------- - -@A(1, 2,) diff --git a/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest b/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest deleted file mode 100644 index 32c925f9a..000000000 --- a/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline p { - f(1, 2,); -} - -// ----------------------------------------------------------------------------- - -pipeline p { - f(1, 2,); -} diff --git a/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest deleted file mode 100644 index c1f7357d5..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -annotation A(a: Int, b: Int,) - -// ----------------------------------------------------------------------------- - -annotation A(a: Int, b: Int,) diff --git a/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest deleted file mode 100644 index 60c557af2..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline p { - (first, second,) {}; -} - -// ----------------------------------------------------------------------------- - -pipeline p { - (first, second,) {}; -} diff --git a/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest deleted file mode 100644 index 27e465733..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment s( - f: (x: Int, y: Int,) -> () -) {} - -// ----------------------------------------------------------------------------- - -segment s( - f: (x: Int, y: Int,) -> () -) {} diff --git a/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest deleted file mode 100644 index e9450d923..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class C(a: Int, b: Int,) - -// ----------------------------------------------------------------------------- - -class C(a: Int, b: Int,) diff --git a/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest deleted file mode 100644 index b4e40c6b6..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum E { - A(a: Int, b: Int,) -} - -// ----------------------------------------------------------------------------- - -enum E { - A(a: Int, b: Int,) -} diff --git a/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest deleted file mode 100644 index 9a9cc4825..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline p { - (first, second,) -> 1; -} - -// ----------------------------------------------------------------------------- - -pipeline p { - (first, second,) -> 1; -} diff --git a/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest deleted file mode 100644 index 094ebfb17..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun f(a: Int, b: Int,) - -// ----------------------------------------------------------------------------- - -fun f(a: Int, b: Int,) diff --git a/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest b/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest deleted file mode 100644 index 50846c18c..000000000 --- a/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment s(a: Int, b: Int,) {} - -// ----------------------------------------------------------------------------- - -segment s(a: Int, b: Int,) {} diff --git a/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest b/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest deleted file mode 100644 index 529a56f3b..000000000 --- a/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -segment s( - f: () -> (x: Int, y: Int,) -) {} - -// ----------------------------------------------------------------------------- - -segment s( - f: () -> (x: Int, y: Int,) -) {} diff --git a/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest b/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest deleted file mode 100644 index 919b400d6..000000000 --- a/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun f() -> (first: Int, second: Int,) - -// ----------------------------------------------------------------------------- - -fun f() -> (first: Int, second: Int,) diff --git a/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest b/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest deleted file mode 100644 index 42646bfc2..000000000 --- a/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -segment s() -> (first: Int, second: Int,) {} - -// ----------------------------------------------------------------------------- - -segment s() -> (first: Int, second: Int,) {} diff --git a/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest b/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest deleted file mode 100644 index ede5ed5e2..000000000 --- a/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline p { - f(); -} - -// ----------------------------------------------------------------------------- - -pipeline p { - f(); -} diff --git a/tests/resources/formatting/trailing commas/type argument list of call.sdstest b/tests/resources/formatting/trailing commas/type argument list of call.sdstest deleted file mode 100644 index 1364593ec..000000000 --- a/tests/resources/formatting/trailing commas/type argument list of call.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline p { - f(); -} - -// ----------------------------------------------------------------------------- - -pipeline p { - f(); -} diff --git a/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest b/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest deleted file mode 100644 index ef0e962a3..000000000 --- a/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -class C - -// ----------------------------------------------------------------------------- - -class C diff --git a/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest b/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest deleted file mode 100644 index 46d78026d..000000000 --- a/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest +++ /dev/null @@ -1,9 +0,0 @@ -enum E { - A -} - -// ----------------------------------------------------------------------------- - -enum E { - A -} diff --git a/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest b/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest deleted file mode 100644 index 58cc04190..000000000 --- a/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -fun f() - -// ----------------------------------------------------------------------------- - -fun f() diff --git a/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest b/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest deleted file mode 100644 index b6762571b..000000000 --- a/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest +++ /dev/null @@ -1,16 +0,0 @@ -segment s( - f: ( - a: A.B, - b: Int - ) -> () -) {} - - -// ----------------------------------------------------------------------------- - -segment s( - f: ( - a: A.B, - b: Int - ) -> () -) {} diff --git a/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest b/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest deleted file mode 100644 index a3965cf66..000000000 --- a/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest +++ /dev/null @@ -1,15 +0,0 @@ -segment s( - f: () -> ( - x: A.B, - y: Int - ) -) {} - -// ----------------------------------------------------------------------------- - -segment s( - f: () -> ( - x: A.B, - y: Int - ) -) {} diff --git a/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest b/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest deleted file mode 100644 index 1b23076d3..000000000 --- a/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ syntax_error - -pipeline myPipeline { - f<(); -} diff --git a/tests/resources/grammar/expressions/calls/good-complex call.sdstest b/tests/resources/grammar/expressions/calls/good-complex call.sdstest deleted file mode 100644 index 9ae472078..000000000 --- a/tests/resources/grammar/expressions/calls/good-complex call.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f<*, in Number, out Number, T = Number>(1, b = 2); -} diff --git a/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest b/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest deleted file mode 100644 index 3815dcbc4..000000000 --- a/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest b/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest deleted file mode 100644 index 24dcd3a17..000000000 --- a/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest b/tests/resources/grammar/expressions/calls/good-mixed positional and named arguments.sdstest similarity index 75% rename from tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest rename to tests/resources/grammar/expressions/calls/good-mixed positional and named arguments.sdstest index 2076ae218..5d992779c 100644 --- a/tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest +++ b/tests/resources/grammar/expressions/calls/good-mixed positional and named arguments.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error pipeline myPipeline { - f<>(); + f(1, b = 2); } diff --git a/tests/resources/grammar/expressions/calls/good-named type argument with test markers.sdstest b/tests/resources/grammar/expressions/calls/good-named type argument with test markers.sdstest deleted file mode 100644 index 1233c71f7..000000000 --- a/tests/resources/grammar/expressions/calls/good-named type argument with test markers.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f<»T = Int«>(); -} diff --git a/tests/resources/grammar/expressions/calls/good-named type argument.sdstest b/tests/resources/grammar/expressions/calls/good-named type argument.sdstest deleted file mode 100644 index 82bfb5c62..000000000 --- a/tests/resources/grammar/expressions/calls/good-named type argument.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest b/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest deleted file mode 100644 index 7af0b6fd7..000000000 --- a/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f>(); -} diff --git a/tests/resources/grammar/expressions/calls/good-no type argument list and no arguments.sdstest b/tests/resources/grammar/expressions/calls/good-no arguments.sdstest similarity index 100% rename from tests/resources/grammar/expressions/calls/good-no type argument list and no arguments.sdstest rename to tests/resources/grammar/expressions/calls/good-no arguments.sdstest diff --git a/tests/resources/grammar/expressions/calls/good-positional type argument with tests markers.sdstest b/tests/resources/grammar/expressions/calls/good-positional type argument with tests markers.sdstest deleted file mode 100644 index 748f7fe60..000000000 --- a/tests/resources/grammar/expressions/calls/good-positional type argument with tests markers.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f<»Int«>(); -} diff --git a/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest b/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest deleted file mode 100644 index 40ea5c0cb..000000000 --- a/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f(); -} diff --git a/tests/resources/grammar/expressions/calls/good-star projection.sdstest b/tests/resources/grammar/expressions/calls/good-star projection.sdstest deleted file mode 100644 index dd2baa076..000000000 --- a/tests/resources/grammar/expressions/calls/good-star projection.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f<*>(); -} diff --git a/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest b/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest deleted file mode 100644 index 664f152ca..000000000 --- a/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest +++ /dev/null @@ -1,21 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - /* - * Once Langium supports LL(*) parsing, this should work. - * - * For now, we can either parse - * - f>() or - * - a < f() - * but not both. - * - * The problem is that the parser can't decide with finite lookahead whether - * the first < is the start of a type argument list or the operator of a - * comparison expression. - * - * We decided to only support the second case for now. The first case leads - * to a syntax error. To work around this, you can use the following syntax: - * - f>() - */ - f>(); -} diff --git a/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest b/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest deleted file mode 100644 index 084283794..000000000 --- a/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - // The start of a type argument list of a call could be confused with the less than operator - 1 < a(); -} diff --git a/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest b/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest deleted file mode 100644 index 343063721..000000000 --- a/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline p { - f(); -} diff --git a/tests/resources/validation/other/types/type argument lists/must not have positional type argument after named type argument/main.sdstest b/tests/resources/validation/other/types/type argument lists/must not have positional type argument after named type argument/main.sdstest index 9bbc778a2..07fd351f0 100644 --- a/tests/resources/validation/other/types/type argument lists/must not have positional type argument after named type argument/main.sdstest +++ b/tests/resources/validation/other/types/type argument lists/must not have positional type argument after named type argument/main.sdstest @@ -17,17 +17,3 @@ segment mySegment2( segment mySegment2( f: MyClass<»A = Int«> ) {} - -pipeline myPipeline { - // $TEST$ no error "After the first named type argument all type arguments must be named." - // $TEST$ no error "After the first named type argument all type arguments must be named." - // $TEST$ error "After the first named type argument all type arguments must be named." - // $TEST$ no error "After the first named type argument all type arguments must be named." - call<»Int«, »A = Int«, »Int«, »B = Int«>(); - - // $TEST$ no error "After the first named type argument all type arguments must be named." - call<»Int«>(); - - // $TEST$ no error "After the first named type argument all type arguments must be named." - call<»A = Int«>(); -}