mirror of
https://github.com/dart-lang/sdk
synced 2024-07-19 20:17:27 +00:00
[cfe] Fix crash on const constructor tear-off
Closes #46133. Bug: https://github.com/dart-lang/sdk/issues/46133 Change-Id: I73035d2b27a2d8116fa7c31abdebfdd7299d6898 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212572 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
c14d66253c
commit
d120af39c6
|
@ -4833,6 +4833,8 @@ class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
} else if (type is ParserRecovery) {
|
||||
push(new ParserErrorGenerator(
|
||||
this, nameToken, fasta.messageSyntheticToken));
|
||||
} else if (type is InvalidExpression) {
|
||||
push(type);
|
||||
} else if (type is Expression) {
|
||||
push(createInstantiationAndInvocation(
|
||||
() => type, typeArguments, name, name, arguments,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// 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.
|
||||
|
||||
class A {}
|
||||
|
||||
test() => A.const.toString();
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,28 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:18: Error: Expected an identifier, but got '.'.
|
||||
// Try inserting an identifier before '.'.
|
||||
// test() => A.const.toString();
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
// Try inserting an identifier before 'const'.
|
||||
// test() => A.const.toString();
|
||||
// ^^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
Try inserting an identifier before 'const'.
|
||||
test() => A.const.toString();
|
||||
^^^^^";
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,28 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:18: Error: Expected an identifier, but got '.'.
|
||||
// Try inserting an identifier before '.'.
|
||||
// test() => A.const.toString();
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
// Try inserting an identifier before 'const'.
|
||||
// test() => A.const.toString();
|
||||
// ^^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
Try inserting an identifier before 'const'.
|
||||
test() => A.const.toString();
|
||||
^^^^^";
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,3 @@
|
|||
class A {}
|
||||
test() => A.const.toString();
|
||||
main() {}
|
|
@ -0,0 +1,28 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:18: Error: Expected an identifier, but got '.'.
|
||||
// Try inserting an identifier before '.'.
|
||||
// test() => A.const.toString();
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
// Try inserting an identifier before 'const'.
|
||||
// test() => A.const.toString();
|
||||
// ^^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
Try inserting an identifier before 'const'.
|
||||
test() => A.const.toString();
|
||||
^^^^^";
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,20 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:18: Error: Expected an identifier, but got '.'.
|
||||
// Try inserting an identifier before '.'.
|
||||
// test() => A.const.toString();
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,28 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:18: Error: Expected an identifier, but got '.'.
|
||||
// Try inserting an identifier before '.'.
|
||||
// test() => A.const.toString();
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
// Try inserting an identifier before 'const'.
|
||||
// test() => A.const.toString();
|
||||
// ^^^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46133.dart:7:13: Error: Expected an identifier, but got 'const'.
|
||||
Try inserting an identifier before 'const'.
|
||||
test() => A.const.toString();
|
||||
^^^^^";
|
||||
static method main() → dynamic {}
|
|
@ -23,6 +23,7 @@ regress/utf_16_le_content.crash: EmptyOutput
|
|||
const_functions/const_functions_const_ctor: FormatterCrash
|
||||
const_functions/const_functions_const_ctor_error: FormatterCrash
|
||||
const_functions/const_functions_const_factory: FormatterCrash
|
||||
constructor_tearoffs/issue46133: FormatterCrash
|
||||
constructor_tearoffs/issue47075: FormatterCrash
|
||||
dart2js/late_fields: FormatterCrash
|
||||
dart2js/late_statics: FormatterCrash
|
||||
|
|
Loading…
Reference in a new issue