mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Add failing test for 'v<int>.^'.
Change-Id: Ib2587e8c5b845cc65d029750ede23c6d4f9206c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232685 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
49d7f5056f
commit
a646c11592
2 changed files with 56 additions and 0 deletions
|
@ -130,6 +130,36 @@ enum E {
|
|||
..argumentList.isSynthetic;
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/48380')
|
||||
void test_enum_constant_name_typeArguments_dot_semicolon() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {
|
||||
v<int>.;
|
||||
}
|
||||
''');
|
||||
parseResult.assertErrors([
|
||||
error(ParserErrorCode.ENUM_CONSTANT_WITH_TYPE_ARGUMENTS_WITHOUT_ARGUMENTS,
|
||||
12, 5),
|
||||
error(ParserErrorCode.MISSING_IDENTIFIER, 18, 1),
|
||||
]);
|
||||
|
||||
var E = parseResult.findNode.enumDeclaration('enum E');
|
||||
var v = parseResult.findNode.enumConstantDeclaration('v<int>');
|
||||
check(v).name.name.isEqualTo('v');
|
||||
|
||||
var arguments = check(v).arguments.isNotNull;
|
||||
arguments.typeArguments.isNotNull;
|
||||
|
||||
var constructorSelector = arguments.constructorSelector.isNotNull;
|
||||
var syntheticName = constructorSelector.value.name;
|
||||
constructorSelector.name.isSynthetic;
|
||||
|
||||
arguments.argumentList
|
||||
..isSynthetic
|
||||
..leftParenthesis.isLinkedToPrevious(syntheticName.token)
|
||||
..rightParenthesis.isLinkedToNext(E.semicolon!);
|
||||
}
|
||||
|
||||
void test_enum_constant_withTypeArgumentsWithoutArguments() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E<T> {
|
||||
|
|
|
@ -33,12 +33,38 @@ extension TokenExtension on CheckTarget<Token> {
|
|||
fail('Not synthetic');
|
||||
}
|
||||
|
||||
CheckTarget<Token?> get next {
|
||||
return nest(
|
||||
value.next,
|
||||
(selected) => 'has next ${valueStr(selected)}',
|
||||
);
|
||||
}
|
||||
|
||||
CheckTarget<Token?> get previous {
|
||||
return nest(
|
||||
value.previous,
|
||||
(selected) => 'has previous ${valueStr(selected)}',
|
||||
);
|
||||
}
|
||||
|
||||
CheckTarget<TokenType> get type {
|
||||
return nest(
|
||||
value.type,
|
||||
(selected) => 'has type ${valueStr(selected)}',
|
||||
);
|
||||
}
|
||||
|
||||
void isLinkedToNext(Token next) {
|
||||
this.next.isEqualTo(next);
|
||||
nest(next, (value) => 'next ${valueStr(value)}').previous.isEqualTo(value);
|
||||
}
|
||||
|
||||
void isLinkedToPrevious(Token previous) {
|
||||
nest(previous, (value) => 'given previous ${valueStr(value)}')
|
||||
.next
|
||||
.isEqualTo(value);
|
||||
this.previous.isEqualTo(previous);
|
||||
}
|
||||
}
|
||||
|
||||
extension TokenQuestionExtension on CheckTarget<Token?> {
|
||||
|
|
Loading…
Reference in a new issue