blob: 9ebed01c3d5e13e5f17dae61460317f8263bb358 [file] [log] [blame]
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'parser_diagnostics.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(FunctionTypedParameterVarTest);
});
}
@reflectiveTest
class FunctionTypedParameterVarTest extends ParserDiagnosticsTest {
test_superFormalParameter_var_functionTyped() async {
var parseResult = parseStringWithErrors(r'''
class A {
A(var super.a<T>());
}
''');
parseResult.assertErrors([
error(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, 14, 3),
]);
var node = parseResult.findNode.superFormalParameter('super.a');
assertParsedNodeText(node, r'''
SuperFormalParameter
superKeyword: super
period: .
identifier: SimpleIdentifier
token: a
typeParameters: TypeParameterList
leftBracket: <
typeParameters
TypeParameter
name: SimpleIdentifier
token: T
rightBracket: >
parameters: FormalParameterList
leftParenthesis: (
rightParenthesis: )
''');
}
}