Files
sdk/pkg/front_end/testcases/nnbd/never_receiver.dart
T
Jens Johansen 4c0cab024e [parser] No longer support ?.[ syntax
Update CFE tests (and a few analyzer tests) to match the new world
of the syntax being unsupported.

Fixes https://github.com/dart-lang/sdk/issues/42681

Change-Id: I71bc973f36dfb978ddb825edb68530d8e260a58a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157980
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-11 08:09:59 +00:00

41 lines
1.0 KiB
Dart

// Copyright (c) 2020, 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.
foo(Never x, Never? y) {
var local0 = y.toString(); // Not an error.
var local1 = y.hashCode; // Not an error.
x.foo(); // Not an error.
x.bar; // Not an error.
x.baz = 42; // Not an error.
x(); // Not an error.
x[42]; // Not an error.
x[42] = 42; // Not an error.
x++; // Not an error.
x += 1; // Not an error.
y?.foo(); // Not an error.
y?.bar; // Not an error.
y?.baz = 42; // Not an error.
y?.call(); // Not an error.
y?[42]; // Not an error.
y?[42] = 42; // Not an error.
x?.foo(); // Warning.
x?.bar; // Warning.
x?.baz = 42; // Warning.
x?[42]; // Warning.
x?[42] = 42; // Warning.
y.foo(); // Error.
y.bar; // Error.
y.baz = 42; // Error.
y(); // Error.
y++; // Error.
y += 1; // Error.
y[42]; // Error.
y[42] = 42; // Error.
}
main() {}