Before this CL we could both crash and add wrong metadata to "part"
nodes when a part defined other parts.
This CL fixes it by
a) Not resetting a counter so *every* part in a part will be out of
bounds when trying to reference it; and
b) Check if a part directive is in bounds and ignore it if it isn't
(an error should already have been issued).
Change-Id: I3d31f2577b2120df6461c9cc1002131dbee9dbbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This reverts commit 9db4119b67.
Revert "Change default of 'keepFields' in constant transformation to true"
This reverts commit b1e14cbe5f.
Revert "[fasta] Don't create forwarding stub if there's already a member"
This reverts commit 51da94da76.
These commits are reverted to unblock rolls into Flutter.
b1e14cbe5f is reverted because it contained
changes that prevented clean revert of the other CLs.
Change-Id: I8d3c00f0c1b146f4debe7f1a1a7de75be154e265
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97802
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Add spread elements to the Kernel syntax. They are currently replaced
by an invalid expression during type inference.
Change-Id: Icdb489e2c9993c6517983cfafdefc801ebb378ab
Reviewed-on: https://dart-review.googlesource.com/c/94501
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
The criterion for an empty set/map literal without type arguments to
become a set literal was implemented as "superclass of Set and not
superclass of Map". This CL changes it to the rule now stated in the
spec: "subtype of Iterable and not subtype of Map".
Change-Id: I52d3a11e29ed9b1feb0f2b52a3f4beebe3833e31
Reviewed-on: https://dart-review.googlesource.com/c/88828
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
The test exposes three problems:
- The disambiguation criterion in the type inference is incorrect, as
it infers a map when the context is a LinkedHashSet. This will be
fixed in an upcoming CL.
- Assigning a map literal to a LinkedHashMap produces a static error
("isn't of expected type") due to exact types. Rules for exact types
are currently unspecified, and the language team has expressed some
interest in allowing this case. See also
https://github.com/dart-lang/sdk/issues/33307
- Type arguments for the map literal are not inferred from the context
when the outer context type is a LinkedHashMap. This is consistent
between the CFE and analyzer. If the LinkedHashMap case is to be
supported, this must be fixed as well.
Change-Id: I1519c844dae1f599306446c992cfe4825e4f20d4
Reviewed-on: https://dart-review.googlesource.com/c/88726
Reviewed-by: Peter von der Ahé <ahe@google.com>
In Dart2, mixin application classes are generated by kernel and type resolution
is performed by kernel. In Dart1, using the VM parser, these tasks were done
during class and type finalization.
Change-Id: I927b1446d906ffd76ed9591c96e0d974df09f3bf
Reviewed-on: https://dart-review.googlesource.com/c/87025
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
We get an AmbiguousBuilder if there are more than one redirecting
factory with the same name. We shouldn't crash though.
Fixes#35266.
Bug: 35266
Change-Id: I1ac0babdde49c4ca3966e6af5c580191baac0873
Reviewed-on: https://dart-review.googlesource.com/c/85390
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Before this CL, running fasta compile on these 3 tests would make it
crash in type inference because the enclosingClass on a constrcutor
is null:
tests/language_2/const_error_multiply_initialized_test.dart
tests/language_2/constructor_duplicate_final_test.dart
tests/language_2/field3_test.dart
Note that these tests are all multi-tests and they are here run
unprocessed. The compiler crashes only after issuing errors.
The crash likely happens because of multiple definitions of
constructors with the same name.
This is a cut-down version that crashed prior to this CL:
```
class C {
final d;
C() {}
C(this.d) {}
}
```
Fixes#35258.
Change-Id: I350c55428932ef0ae76f78875177b08acf95cdfc
Reviewed-on: https://dart-review.googlesource.com/c/85363
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Without this CL we end up putting a null-reference in the tree because
the parent is never set on the redirecting constructor we try pointing
to.
Fixes#35259, #35260.
Change-Id: I8ad520453742ff1de8dd9ca5e619f9edbff9971c
Reviewed-on: https://dart-review.googlesource.com/c/85384
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
The code in class_hierarchy.dart that looped over override pairs
included implementations inherited from its superclass as potential
overriders, presumably in a broken attempt to include some interface
checks into the mix.
With this problem fixed, the special case in kernel_class_builder.dart
that excluded overriders not declared in the current class (i.e.
declared in a mixin) could be removed without incurring false
positives.
These override checks performed on members from a mixin produce an
extra context message indicating the class where the two members meet,
giving rise to the override relation (similarly to interface checks).
Since the same member can now override more than one member (or even
the same member more than once), the diagnostics message duplication
check has been extended to also include the context in the comparison.
Fixes https://github.com/dart-lang/sdk/issues/34235
Fixes https://github.com/dart-lang/sdk/issues/34285
Change-Id: I990e5719ae1749fd1aad1ad478aaa6e173cb170b
Reviewed-on: https://dart-review.googlesource.com/c/76900
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>