Files
sdk/pkg/front_end/testcases/invalid_assignment.dart.strong.expect
T
Peter von der Ahé 1e312819ca Ensure errors guard erroneous expressions.
This changes wrapInCompileTimeError so we are certain that
compile-time errors are reported before the erroneous nodes.

We want to preserve erroneous nodes as, long term, this should help
with code completion.

Also introduce a located version as my next CL I'll have slightly
more accurate locations.

Change-Id: Id83d4b7a7d4fe260916816d72fac331251bad948
Reviewed-on: https://dart-review.googlesource.com/50422
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-04-12 14:51:19 +00:00

30 lines
1.8 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
operator +(core::int i) → core::String
return "";
}
static method test(core::int i, core::String s, self::A a) → dynamic {
i = 1;
i = let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:13:36: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
i = /*@error=InvalidAssignment*/ s;
^" in let final dynamic #t2 = s in null;
i.{core::num::==}(null) ?{core::int} i = 1 : null;
i.{core::num::==}(null) ?{core::Object} i = let final dynamic #t3 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:15:38: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
i ??= /*@error=InvalidAssignment*/ s;
^" in let final dynamic #t4 = s in null : null;
a = new self::A::•();
a = let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/invalid_assignment.dart:17:34: Error: A value of type 'dart.core::String' can't be assigned to a variable of type '#lib1::A'.
Try changing the type of the left hand side, or casting the right hand side to '#lib1::A'.
a /*@error=InvalidAssignment*/ += 1;
^" in let final dynamic #t6 = a.{self::A::+}(1) in null;
}
static method main() → dynamic {}