5ec9f6bcbd
Change-Id: Ibcdf52ce7eb17098193b9a330e6009926ffe6d2f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151625 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
65 lines
2.6 KiB
Dart
65 lines
2.6 KiB
Dart
// Copyright (c) 2018, 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 {
|
|
static String? s = "something";
|
|
var a = "anything";
|
|
var x;
|
|
|
|
foo() => null;
|
|
bar(var y) => y;
|
|
static sfoo() => null;
|
|
static sbar(var y) => y;
|
|
|
|
A.next();
|
|
|
|
A(); //# 00: ok
|
|
A() : this.next(); //# 01: ok
|
|
|
|
A() : x = s; //# 02: ok
|
|
A() : x = sfoo(); //# 03: ok
|
|
A() : x = sbar(null); //# 04: ok
|
|
A() : x = a; //# 05: compile-time error
|
|
A() : x = foo(); //# 06: compile-time error
|
|
A() : x = bar(null); //# 07: compile-time error
|
|
A() : x = bar(this); //# 08: compile-time error
|
|
A() : x = this; //# 09: compile-time error
|
|
A() : x = this.a; //# 10: compile-time error
|
|
A() : x = this.foo(); //# 11: compile-time error
|
|
A() : x = this.bar(null); //# 12: compile-time error
|
|
A() : x = this.bar(this); //# 13: compile-time error
|
|
A() : x = sbar(this); //# 14: compile-time error
|
|
A() : x = sbar(this.a); //# 15: compile-time error
|
|
A() : x = sbar(this.foo()); //# 16: compile-time error
|
|
A() : x = sbar(this.bar(null)); //# 17: compile-time error
|
|
A() : x = sbar(this.bar(this)); //# 18: compile-time error
|
|
|
|
A() : this.x = (() => null); //# 19: ok
|
|
A() : this.x = (() => s)(); //# 20: ok
|
|
A() : this.x = ((c) => c); //# 21: ok
|
|
A() : this.x = ((c) => s)(null); //# 22: ok
|
|
A() : this.x = ((c) => c)(this); //# 23: compile-time error
|
|
A() : this.x = (() => this); //# 24: compile-time error
|
|
A() : this.x = (() => this.a)(); //# 25: compile-time error
|
|
A() : this.x = ((c) => this.foo()); //# 26: compile-time error
|
|
A() : this.x = ((c) => a)(null); //# 27: compile-time error
|
|
A() : this.x = ((c) => foo())(s); //# 28: compile-time error
|
|
A() : this.x = sbar((() { return null; })); //# 29: ok
|
|
A() : this.x = sbar((() { return s; })()); //# 30: ok
|
|
A() : this.x = sbar(((c) { return c; })); //# 31: ok
|
|
A() : this.x = sbar(((c) { return s; })(null)); //# 32: ok
|
|
A() : this.x = sbar(((c) { return c; })(this)); //# 33: compile-time error
|
|
A() : this.x = sbar((() { return this; })); //# 34: compile-time error
|
|
A() : this.x = sbar((() { return this.a; })()); //# 35: compile-time error
|
|
A() : this.x = sbar(((c) { return this.foo(); })); //# 36: compile-time error
|
|
A() : this.x = sbar(((c) { return a; })(null)); //# 37: compile-time error
|
|
A() : this.x = sbar(((c) { return foo(); })(s)); //# 38: compile-time error
|
|
|
|
A() : this.x = (s = null); //# 39: ok
|
|
A() : this.x = (a = null); //# 40: compile-time error
|
|
A() : this.x = (this.a = null); //# 41: compile-time error
|
|
}
|
|
|
|
main() {}
|