(extracted from the other CL that adds support for deferred loading)
Change-Id: I0e63a6fc2926fd451796b9bbed27e404d55e7f23
Reviewed-on: https://dart-review.googlesource.com/13662
Reviewed-by: Peter von der Ahé <ahe@google.com>
When compiling an if statement, the condition is converted to a value
via popForValue() in beginThenStatement(), so when the condition is
later popped in endIfStatement(), we can just pop() it directly.
A similar situation exists for the "condition" and "then" parts of a
conditional expression, and for the "receiver" part of a logical
operation.
Change-Id: I9f9f13263b284c99fbbfeb38e4a987d0d4fe9e30
Reviewed-on: https://dart-review.googlesource.com/15380
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL makes fasta issue an error when trying to create a non-const
ListLiteral or MapLiteral in a context where const is required.
Bug:
Change-Id: I27ea151a38eb1198faa83a8cfa57453a4e225e1a
Reviewed-on: https://dart-review.googlesource.com/15460
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Also add a test to verify that contravariance is properly handled for
method calls using "if-null" syntax (since this is handled by a
slightly different code path in the front end).
Change-Id: I93ee8b38ff39d78e25cac23ff048fcf69f15b5db
Reviewed-on: https://dart-review.googlesource.com/15000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
BodyBuilder converts an expression in a for loop initializer to the
initialization of a dummy variable. It needed to create this dummy
variable using ShadowVariableDeclaration to ensure that type inference
would be applied to the dummy variable.
Fixes#31133
Change-Id: Ibe5ed95f20429af633cbe8d49b06aabaa9df41fd
Reviewed-on: https://dart-review.googlesource.com/15001
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This streamlines checks for valid methods modifiers in fasta
and improves recovery and error messages when method modifiers
are out of order or invalid.
Change-Id: I045cc4d7cc15945354abe49827a770d346d234a3
Reviewed-on: https://dart-review.googlesource.com/14360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Resolution of method forwarding nodes, and inference of method types,
happens during the "prepare" phase of type inference, since in theory
method types and method forwarding nodes can only depend on methods in
base classes. Resolution of getter/setter forwarding nodes, and
inference of getter/setter/field types, happens later, after all
forwarding nodes have been created. This works properly for code that
is free of errors.
But if the code has errors, it's possible that a method might try to
override a getter, setter, or field. If this happens, we don't want
resolution of the method forwarding node, or inference of the method,
to trigger premature type inference of the getter/setter/field; if it
did, this might cause us to infer the wrong type for the
getter/setter/field, leading to user confusion.
This CL adds a check to ensure that we don't resolve any
getter/setter/field nodes during the "prepare" phase of type
inference.
Change-Id: I794d6ba5fde7937bbec3cf7c21a1c3c602e6bbd1
Reviewed-on: https://dart-review.googlesource.com/14364
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The first phase, called `resolve`, happens during top level type
inference; it determines which inherited method a forwarding node
resolves to, and ensures that dependencies are type inferred. The
second phase, called `finalize`, happens at the end of top level type
inference; it creates forwarding stubs if necessary and propagates
covariance annotations.
The reason we need two phases is illustrated by the new test
pkg/front_end/testcases/inference/inheritance_does_not_imply_circularity.dart.
There should be a type inference dependency from I1::x to y, and from
y to C::x. But there shouldn't be a type inference dependency from
C::x to I1::x, since C::x's type is fully specified.
Splitting into two phases makes this work: during type inference, we
can resolve C::x without needing to consult the type of I1::x. Once
type inference is over, and the type of I1::x has been determined, we
can finalize C::x and determine whether any covariance annotations
need to be propagated.
Change-Id: If96e7b23e16723c421f91b3e37fe2a4485919c5c
Reviewed-on: https://dart-review.googlesource.com/13600
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This reverts commit 4bb83e9311
This reverts commit f1b07b2789.
Reason for revert on analyzer bots:
Analyzing pkg/analyzer...
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:625:9 • undefined_identifier
error • Undefined name 'CompileTimeErrorCode' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:625:18 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:626:13 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:635:9 • undefined_identifier
error • Undefined name 'CompileTimeErrorCode' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:635:18 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:636:13 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:645:9 • undefined_identifier
error • Undefined name 'CompileTimeErrorCode' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:645:18 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:646:13 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:655:9 • undefined_identifier
error • Undefined name 'CompileTimeErrorCode' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:655:18 • undefined_identifier
error • Undefined name 'source' at pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart:656:13 • undefined_identifier
12 errors found.
Change-Id: Ie2035bf40e50c48f85b514c7a3786141cd0f2453
Reviewed-on: https://dart-review.googlesource.com/14061
Reviewed-by: Martin Kustermann <kustermann@google.com>