[CFE] Reproduction of crash etc in error messages wrt formal parameters

Reproduction of dartbug.com/38523

Bug: 38523
Change-Id: Iffc30a622685c0c8d7a0daf0b84c910072c8146f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118446
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2019-09-24 11:43:28 +00:00 committed by commit-bot@chromium.org
parent 1b03bc34c8
commit 98d94e7efc
11 changed files with 143 additions and 0 deletions

View file

@ -251,6 +251,7 @@ best
bets
better
between
beyond
big
bigint
binaries

View file

@ -0,0 +1,7 @@
// Copyright (c) 2019, 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.
library error_location_05;
part 'error_location_05_lib1.dart';

View file

@ -0,0 +1,18 @@
library error_location_05;
//
// Problems in library:
//
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:8: Error: Duplicated parameter name 'z'.
// x1(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:4: Context: Other parameter named 'z'.
// x1(z, {z}) {}
// ^
//
import self as self;
part error_location_05_lib1.dart;
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x1(dynamic z, {dynamic z}) → dynamic
;
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x2() → dynamic
;

View file

@ -0,0 +1,30 @@
library error_location_05;
//
// Problems in library:
//
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:8: Error: Duplicated parameter name 'z'.
// x1(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:4: Context: Other parameter named 'z'.
// x1(z, {z}) {}
// ^
//
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:10:9: Error: 'z' is already declared in this scope.
// y(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_05.dart:7:27: Context: Previous declaration of 'z'.
// part 'error_location_05_lib1.dart';
// ^
//
import self as self;
import "dart:core" as core;
part error_location_05_lib1.dart;
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x1(dynamic z = #C1, {dynamic z = #C1}) → dynamic {}
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x2() → dynamic {
function y(dynamic z, {dynamic z = #C1}) → core::Null? {}
}
constants {
#C1 = null
}

View file

@ -0,0 +1,30 @@
library error_location_05;
//
// Problems in library:
//
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:8: Error: Duplicated parameter name 'z'.
// x1(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:7:4: Context: Other parameter named 'z'.
// x1(z, {z}) {}
// ^
//
// pkg/front_end/testcases/general/error_locations/error_location_05_lib1.dart:10:9: Error: 'z' is already declared in this scope.
// y(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_05.dart:7:27: Context: Previous declaration of 'z'.
// part 'error_location_05_lib1.dart';
// ^
//
import self as self;
import "dart:core" as core;
part error_location_05_lib1.dart;
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x1(dynamic z = #C1, {dynamic z = #C1}) → dynamic {}
static method /* from org-dartlang-testcase:///error_location_05_lib1.dart */ x2() → dynamic {
function y(dynamic z, {dynamic z = #C1}) → core::Null? {}
}
constants {
#C1 = null
}

View file

@ -0,0 +1,11 @@
// Copyright (c) 2019, 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.
part of error_location_05;
x1(z, {z}) {}
x2() {
y(z, {z}) {}
}

View file

@ -0,0 +1,7 @@
// Copyright (c) 2019, 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.
library error_location_06;
part 'error_location_06_lib1.dart';

View file

@ -0,0 +1,18 @@
library error_location_06;
//
// Problems in library:
//
// pkg/front_end/testcases/general/error_locations/error_location_06_lib1.dart:12:8: Error: Duplicated parameter name 'z'.
// x1(z, {z}) {}
// ^
// pkg/front_end/testcases/general/error_locations/error_location_06_lib1.dart:12:4: Context: Other parameter named 'z'.
// x1(z, {z}) {}
// ^
//
import self as self;
part error_location_06_lib1.dart;
static method /* from org-dartlang-testcase:///error_location_06_lib1.dart */ x1(dynamic z, {dynamic z}) → dynamic
;
static method /* from org-dartlang-testcase:///error_location_06_lib1.dart */ x2() → dynamic
;

View file

@ -0,0 +1,16 @@
// Copyright (c) 2019, 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.
// Lots of comment lines that pushes the length of this file beyond that of
// error_location_06. This in turn causes the (first) 'z' in 'x2' to get an
// offset that is larger than the largest valid offset in error_location_06.
// This in turn can cause a crash, if the fileUri for that z is the wrong file.
part of error_location_06;
x1(z, {z}) {}
x2() {
y(z, {z}) {}
}

View file

@ -6,6 +6,9 @@
# Kernel ASTs directly, that is, code in pkg/fasta/lib/src/kernel/ with
# strong-mode enabled.
general/error_locations/error_location_05: RuntimeError # Has errors in it.
general/error_locations/error_location_06: Crash # Has errors in it.
extensions/instance_access_of_static: RuntimeError
extensions/invalid_explicit_access: RuntimeError
extensions/static_access_of_instance: RuntimeError

View file

@ -131,6 +131,8 @@ general/error_locations/error_location_01: TextSerializationFailure
general/error_locations/error_location_02: TextSerializationFailure
general/error_locations/error_location_03: TextSerializationFailure
general/error_locations/error_location_04: TextSerializationFailure
general/error_locations/error_location_05: TextSerializationFailure
general/error_locations/error_location_06: Crash
general/escape: TextSerializationFailure # Was: Pass
general/export_main: TextSerializationFailure # Was: Pass
general/export_test: TextSerializationFailure # Was: Pass