Commit graph

25 commits

Author SHA1 Message Date
Erik Ernst
3a7eeb6315 Rename is{Strong,Weak}Mode to has{Sound,Unsound}NullSafety
Change-Id: If3912d75c5f89a741299b2fae4299d01ac928eec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170424
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-11-05 14:26:53 +00:00
Srujan Gaddam
c990450628 [package:js] Add checks for external keyword
Checks to see if a JS interop member is correctly annotated with
the `external` keyword. If it is not, it must be one of several
exceptions to be allowed.

This CL also changes static errors to first check for `JS` and
`external` before processing the member as a JS interop member.
This makes it clearer whether a member is a JS member.

Change-Id: I412eeafbfe8773847bfb9c864e4fb9b65e2d632a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158083
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-09-25 23:30:34 +00:00
Mayank Patke
6e30428829 [dart2js] Add tests for https://dart-review.googlesource.com/c/sdk/+/162420.
Change-Id: Ifc4f060a72dc273d130ba33d5f61cd4c7e014fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162580
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-09-11 22:53:35 +00:00
Srujan Gaddam
e51623f81a [package:js] Add errors for missing @JS on class
Adds errors for class members that have a @JS annotation but the
enclosing class does not.

Change-Id: Id693af71678510047a723863846d89aa29cebe26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157004
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-08-07 17:09:23 +00:00
Mayank Patke
12be370067 [dart2js] Fix missing braces in
internal/deferred/load_in_correct_order_test.

Change-Id: I9691be06ce061b174f675261688797f9cd1f78f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156641
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
2020-07-31 14:59:00 +00:00
Mayank Patke
5671730c5a [dart2js] Pass type arguments to callable properties even with
--omit-implicit-checks.

When the default check policy is "trusted" instead of "emitted", we skip
checking every function during the RTI need computation. This works
because if the type arguments are needed for some other reason, like the
literal being used in the body, we see the type use and go back and
update the RTI need of the function. We can't do this for callable
properties because we don't know which function will be assigned at
runtime, so we need to conservatively provide type arguments no matter
what.

We could optimize this slightly by only providing type arguments if we
know a type use occurs in a function which is assignable to the type of
the property, but I expect this to save little for the amount of
overhead during compilation.

We also update the dependency computation to ensure that if a callable
property needs type arguments, then they're available for the enclosing
context to pass along.

Bug: https://github.com/dart-lang/sdk/issues/41449
Fixes: https://github.com/dart-lang/sdk/issues/41449
Change-Id: I98d9024dfa64cbfe33bd43172ffa905a8537649e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154284
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-07-24 11:09:15 +00:00
Srujan Gaddam
7c40665f91 [package:js] Add static errors for named parameters and tests
Adds error for named params in JS interop functions, static error
tests, and removes redundant code from dart2js.

Change-Id: Ie16ebdd7a816983c1250579ea346e31e77227112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154752
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-20 20:27:07 +00:00
Stephen Adams
a38e265f04 Fix #42531
Bad identifier for async closure generator body names in extension methods.

Fixed: 42531
Change-Id: Ice29bb5ac03c67b1024c0fd53ffdb9b9b1d2131f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153484
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-07-08 19:29:45 +00:00
Mayank Patke
5c99205769 [dart2js] Support required named parameters in weak NNBD function types.
We cannot simply discard the `required` modifier in weak mode function
types since function types that differ in the placement of `required`
cannot compare equal. Instead, we do that during subtype checks.

We continue to ignore `required` in the actual calling convention in
weak mode.

Change-Id: I7dbb28550095c635f65592f78e495e8e4e8d7026
Fixes: https://github.com/dart-lang/sdk/issues/42608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153386
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-07-07 21:00:40 +00:00
Johnni Winther
b6a0c50bf6 [dart2js] Support conversion of local function type variables from K to J model
This CL adds support for converting local function type variables from
the K model to the J model. The entity use for the J model type variables
isn't created before the closure classes and closure call methods have
been created. Therefore, the [ClosureData] is now registered
with the [JsToFrontendMap] object, once computed, allowing conversion of
local function type variables. Conversion of [BackendUsage] is moved
after closure creation because [RuntimeTypeUse] can refer to local
function type variables.

Closes #42088

Change-Id: Ifc00e69b5db0dd05710ea97017c41e8c7f5e520e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153080
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-07 06:46:21 +00:00
Mayank Patke
e8daaefabf [dart2js] Ensure generic local functions are marked as potentially
needing type arguments.

Change-Id: I50831df2530395b9ec3562be171422b0b6455335
Bug: https://github.com/dart-lang/sdk/issues/42501
Fixes: https://github.com/dart-lang/sdk/issues/42501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152606
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-06-26 21:27:38 +00:00
Mayank Patke
cf62339751 [dart2js] Ensure type arguments are passed when invoking a generic
function property.

Change-Id: I387977e2f1fb7732d94331b7a97cceeec767aaae
Bug: https://github.com/dart-lang/sdk/issues/41449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151301
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-06-24 20:12:39 +00:00
Stephen Adams
7425b3de51 [dart2js] Remove more dead code.
Change-Id: Iff5b3921f40981c8122d7720ce80a5f01731aa47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151883
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-06-19 21:20:07 +00:00
Stephen Adams
0ccc96f470 [dart2js] remove more old-rti code
Change-Id: I462dd6aec1bf39c16e340699b2803254fd4fc941
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151345
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2020-06-17 20:31:01 +00:00
Joshua Litt
3798e5c2f0 [dart2js] Fix some compilation errors in dart2js/native.
Change-Id: Idb614189a31ceaeb53a9acb1f23f0ff3f46eb9c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150666
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-06-16 01:20:18 +00:00
Stephen Adams
cf1681e11e [dart2js] Remove more unused old rti helpers
Change-Id: Icbc50554f2b3ae2cb74b32c9876c7c0cdf15c75b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150640
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-15 18:23:17 +00:00
Stephen Adams
bbeda37c05 Address review comments from 150935
Change-Id: Ia137c8c139e13cb9b3f8017328f5a79edfcbc0b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151022
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-12 05:54:28 +00:00
Stephen Adams
a13a2d7c84 Redo "[dart2js] Delete unused old-rti helpers"
Change-Id: I756a1adde6bbecdb5f28eb93f93041463435476d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151041
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-12 01:29:39 +00:00
Johnni Winther
ab034e69b4 [dart2js] Fix reduction to declared type in type promotion computation
When reducing the type promotion in case of assignment, the target
info wasn't correctly handling the reduction to the trivial state.
This caused an error in a following join computation.


Closes #42281

Change-Id: I2144f5401e9736308dc37147f7a5cb9ab1be8583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150935
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-06-11 18:52:38 +00:00
Stephen Adams
96fc158e4e Revert "[dart2js] Delete unused old-rti helpers"
This reverts commit e75b824aed.

Reason for revert: Break in google3 

Original change's description:
> [dart2js] Delete unused old-rti helpers
> 
> Change-Id: I0f97dddbfcbe5f51dff1d7d68f880e85d62768a4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150504
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

TBR=sra@google.com,sigmund@google.com,joshualitt@google.com

Change-Id: If71d84fda4ce596bb762d32454a4c635185f189f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150780
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-10 17:46:40 +00:00
Stephen Adams
e75b824aed [dart2js] Delete unused old-rti helpers
Change-Id: I0f97dddbfcbe5f51dff1d7d68f880e85d62768a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150504
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-06-09 18:24:53 +00:00
Stephen Adams
89c5b5c904 [dart2js] Call-through stubs must forward type arguments
There are several problems contributing to issue 41449.
This fixes the malformed call-through stubs.

Change-Id: I90f1584f221956ee3fe4111314cba2813a16837c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150283
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-06-08 18:40:53 +00:00
Stephen Adams
4b9c2356e9 [dart2js] Don't confuse value and location.
A HParameterValue can be an SSA value or a mutable local variable
accessed via HLocalFet/HLocalSet. The latter happens in code that is not
completely SSA-converted (due to exception control flow).

The main bug is that the check on a mutable-variable-mode HParameterValue
should have been on a HLocalGet of the value, and not the HParameterValue
itself. This means that a reference to the HParameterValue cannot be
replaced with a strengthening check, as that breaks the invariant that
HLocalGet/Set refer to variables. There was code in types_propagation
that tried to work around this broken invariant.

The bug (issue 42189) required
  - An elided instance method parameter
  - try(-catch)(-finally) to avoid complete SSA-conversion
  - -O0 to avoid optimizing away the check early with inferred types

The first attempt at a fix was to not check the elided parameter at all
since the default value is statically checked. This is still worthwhile.

Bug: 42189
Change-Id: Idd5e2b1485eba4950a36d1e4ff57ebe35e4c98a0
Fixed: 42189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150171
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-07 00:11:11 +00:00
Joshua Litt
451694e855 [dart2js] Move dart2js_native to dart2js/native.
Change-Id: I2f879fe18376b8c1b82fc201d488425dc154d2b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149341
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-06-04 18:11:49 +00:00
Joshua Litt
05ca544f15 [dart2js] Move tests/compiler/dart2js_extra to tests/dart2js_2.
Change-Id: Iaa0ca2b4f2d1b15f79ddca37834d3ed2497bc068
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149242
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-06-03 15:15:30 +00:00