Skip to content

Commit bd9969b

Browse files
committed
Fixes dart-lang#1403. Added test that super cannot be used as an expression
1 parent 08c8887 commit bd9969b

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

Language/Expressions/syntax_t02.dart

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// @assertion An expression is a fragment of Dart code that can be evaluated at
6+
/// run time
7+
/// ...
8+
/// <expression> ::= <assignableExpression> <assignmentOperator> <expression>
9+
/// | <conditionalExpression>
10+
/// | <cascade>
11+
/// | <throwExpression>
12+
/// <expressionWithoutCascade> ::=
13+
/// <assignableExpression> <assignmentOperator> <expressionWithoutCascade>
14+
/// | <conditionalExpression>
15+
/// | <throwExpressionWithoutCascade>
16+
/// <expressionList> ::= <expression> (‘,’ <expression>)*
17+
/// <primary> ::= <thisExpression>
18+
/// | super <unconditionalAssignableSelector>
19+
/// | super <argumentPart>
20+
/// | <functionExpression>
21+
/// | <literal>
22+
/// | <identifier>
23+
/// | <newExpression>
24+
/// | <constObjectExpression>
25+
/// | <constructorInvocation>
26+
/// | ‘(’ <expression> ‘)’
27+
/// <literal> ::= <nullLiteral>
28+
/// | <booleanLiteral>
29+
/// | <numericLiteral>
30+
/// | <stringLiteral>
31+
/// | <symbolLiteral>
32+
/// | <listLiteral>
33+
/// | <setOrMapLiteral>
34+
/// @description Checks that `super` without selector or argument part cannot be
35+
/// used as an expression
36+
/// @author [email protected]
37+
/// @issue 43168
38+
39+
class C {
40+
foo() {
41+
print(super);
42+
// ^^^^^
43+
// [analyzer] unspecified
44+
// [cfe] unspecified
45+
}
46+
}
47+
48+
main() {
49+
C().foo();
50+
}

0 commit comments

Comments
 (0)