Commit Graph

235 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 9c2306c7dc Adapt analyzer to new warnings around switch-case fallthrough.
Fixes issue #27664.
BUG= http://dartbug.com/27664
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2446093003 .

Committed: https://github.com/dart-lang/sdk/commit/1322877f5b3a8c741d73df861169c494311073e8
Committed: https://github.com/dart-lang/sdk/commit/1f7d8924c6e724e11dab4c266d79aac9441a3bd3
2016-10-26 12:56:54 +02:00
Lasse R.H. Nielsen 1322877f5b Adapt analyzer to new warnings around switch-case fallthrough.
Fixes issue #27664.
BUG= http://dartbug.com/27664
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2446093003 .
2016-10-26 10:51:50 +02:00
Lasse R.H. Nielsen 1d4657f3d4 Add test for warning-conditions around switch cases.
Only tested on analyzer.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2446923003 .
2016-10-26 09:02:58 +02:00
Matthias Hausner f73ea62c99 Add check for constness in constructor redirection
Const constructor can only redirect to another const constructor.

BUG=#27617
R=regis@google.com

Review URL: https://codereview.chromium.org/2439593003 .
2016-10-19 15:15:02 -07:00
Florian Schneider d9b1bc93af Fix product mode noSuchMethod with library prefix.
Update analyzer status of test that has a static warning expected.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2413033003 .
2016-10-12 19:10:27 -07:00
Erik Ernst 1c7e4d8346 Corrects tests/language/initializing_formal_promotion_test.dart.
Said test was created for scope rules that do not apply now, but it had
never been updated. This CL moves the relevant expression to the scope
where promotion can take place.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2332253003 .
2016-10-05 16:05:41 +02:00
Regis Crelier 4634faa574 Add new language test for generic function parameter (filed issue #27299).
R=hausner@google.com

Review URL: https://codereview.chromium.org/2333973002 .
2016-09-13 09:24:57 -07:00
Brian Wilkerson a5ee525e14 Add support for accessing field formal parameters in the initializer list of constructors
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2335693002 .
2016-09-12 09:48:34 -07:00
Konstantin Shcheglov f8c32c5ea1 Issue 26860. Report CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR for parameters of function typed constructor parameters.
R=pquitslund@google.com, brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26860

Review URL: https://codereview.chromium.org/2178123003 .
2016-07-25 14:56:47 -07:00
Brian Wilkerson afd21330f7 Generalize the first argument in an assert to be an expression (issue 26865)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2140673004 .
2016-07-12 11:02:51 -07:00
Regis Crelier 455110c6ee Tighten check disallowing use of initializing formals (fixes #26855).
Add regression test.
Add exception for analyzer (filed an issue).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2139003002 .
2016-07-11 15:30:24 -07:00
Johnni Winther 5f243e6bd0 Update tests to make latent errors explicit.
R=het@google.com

Review URL: https://codereview.chromium.org/2121143002 .
2016-07-08 10:41:23 +02:00
Erik Ernst 442fc53b3c Implementation of modified scoping for initializing formals.
In order to make an implementation of initializing formal access in
`dart2js` available as specified in issue #26655 now, this CL changes
the scope management such that initializing formals are not in scope in
the constructor body, only in the initializer list.

This is done by introducing a new notion of scopes implemented
by `ExtensionScope`: Such a scope will extend an existing
`NestedScope` rather than adding a new nested scope to it.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2059883002 .
2016-06-29 11:42:03 +02:00
Regis Crelier e803457081 Silence analyzer choking on new test.
Review URL: https://codereview.chromium.org/2057943002 .
2016-06-09 19:46:57 -07:00
Erik Ernst c3dfe51295 Adds status entries for initializing_formal tests.
This CL should fix the problem that arose with commit
543a51ff3e. Here's the description from
that CL:

This CL adds tests for previously uncovered elements of the semantics
and includes fixes such that the desired behavior is obtained. In
particular, an `isInitializingFormal` element may now occur in contexts
where it wasn't expected until now, and changes were made to handle it.
It is also checked that a capture of an initializing formal (in a
function literal) captures the parameter, not the field.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2042293002 .
2016-06-08 10:50:33 +02:00
Erik Ernst c35caf253e Introduces "--initializing-formal-access".
This CL is an adjusted version of CL 2025853002, adding updates to
`InitializingFormalElementZ` to match the updates applied to
`InitializingFormalElementX`, and adding the new option to the
`MessageKind.DUPLICATE_DEFINITION` example.

Description from 2025853002:

This CL adjusts the treatment of initializing formals, such that they
can be used in initializers and in constructor bodies. E.g., `x` can be
used as in `C(this.x) : y = x { var z = x + 2; }`.

It hides the new feature under the option '--initializing-formal-access'
which is used in the test 'initializing_formal_access_test.dart'.

It also adds an `example` test to `MessageKind.DUPLICATE_DEFINITION` to
verify that name clashes among initializing formals and other
parameters are detected (which was previously not the case).

Finally, it fixes a typo in a comment, `InitializingFormalParameter` ->
`InitializingFormalElement`.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2029003002 .
2016-06-02 11:09:56 +02:00
Erik Ernst 5b72755837 Revert "Introduces "--initializing-formal-access"."
This reverts commit b80a73775c
because introduced new failures in co19 tests.

Review URL: https://codereview.chromium.org/2021133003 .
2016-05-31 18:03:14 +02:00
Erik Ernst b80a73775c Introduces "--initializing-formal-access".
This CL adjusts the treatment of initializing formals, such that they
can be used in initializers and in constructor bodies. E.g., `x` can be
used as in `C(this.x) : y = x { var z = x + 2; }`.

It hides the new feature under the option '--initializing-formal-access'
which is used in the test 'initializing_formal_access_test.dart'.

It also adds an `example` test to `MessageKind.DUPLICATE_DEFINITION` to
verify that name clashes among initializing formals and other
parameters are detected (which was previously not the case).

Finally, it fixes a typo in a comment, `InitializingFormalParameter` ->
`InitializingFormalElement`.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2025853002 .
2016-05-31 15:39:02 +02:00
Erik Ernst af79c19a53 Revision of "Adjusts dart2js backend to handle method type arguments"
Adjusted version of CL https://codereview.chromium.org/1976213002/,
only changed by adding entries in status files for the test
'tests/language/generic_methods_type_expression_test.dart'.

Review URL: https://codereview.chromium.org/2001393003 .
2016-05-24 11:12:02 +02:00
Erik Ernst 912bcc8418 Revert "Adjusts dart2js backend to handle method type arguments."
This reverts commit 04e45eb634.

BUG=

Review URL: https://codereview.chromium.org/2000223002 .
2016-05-23 18:35:53 +02:00
Erik Ernst 04e45eb634 Adjusts dart2js backend to handle method type arguments.
This CL has the same purpose as 1969753002, stated in the title line,
but it works for checked mode execution (where 1969753002 was broken),
and for usage of method type arguments in additional situations.

Approach: `DartType` and subtypes have been extended with new methods
to erase `MethodTypeVariableType` to `DynamicType`. This is done early
(after resolution, before SsaBuilder), such that only few parts of the
compiler need to deal with anything new. This approach handles method
type variables in checked mode, in `new` expressions, and in function
typed parameters. Finally, tests are added for the new cases, and
status files updated.

UPDATE: See message #10 and #12 for an updated description of the approach.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1976213002 .
2016-05-23 17:17:29 +02:00
Erik Ernst 7da48f3a95 Adds DartOptions to generic method syntax tests (updated CL).
This CL was landed and reverted. The bot failures caused by the first
landing of this CL turned out to be caused by checked mode execution.
This is an adjustment of that CL which marks the relevant tests as
failing. The underlying issue is that the compiler phases after
resolution do not expect to receive method type variables, only class
type variables; that will be addressed in a separate CL.

R=floitsch@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org/1963703003 .
2016-05-11 09:46:32 +02:00
Erik Ernst a9d90f4a09 Revert "Adds DartOptions to generic method syntax tests."
This reverts commit ae31db041d,
which seemed to cause failures on dart2js-d8-minified.

BUG=

Review URL: https://codereview.chromium.org/1960193002 .
2016-05-09 18:06:34 +02:00
Erik Ernst ae31db041d Adds DartOptions to generic method syntax tests.
This CL adds a `DartOptions` comment to the '--generic-method-syntax'
related tests specifying that option, and changes the entries for these
tests in status files to expect success for dart2js except when running
in a browser (where the option gets dropped rather than passed on to
the compiler).

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1962633002 .
2016-05-09 17:15:33 +02:00
Brian Wilkerson 8c244f03ad Report when members indirectly inherited through a mixin are not implemented (issue 26411)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1951363003 .
2016-05-06 11:29:44 -07:00
Erik Ernst d55adbed81 Add unit test on dart2js static analysis of method type parameters.
The new test is specifically for `dart2js --generic-method-syntax ..`,
executed programmatically using 'memory_compiler.dart'.
It verifies that each method type variable is treated as if it had
been an alias for `dynamic` (so the static analysis allows almost
all usages of these type variables, silently). Note that this behavior
is unlikely to be available with any other tools, and even `dart2js`
will behave differently when generic methods are implemented fully.
Hence, the new test will only be useful as-is during a transitional
period.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1939053002 .
2016-05-04 15:21:17 +02:00
Florian Loitsch bcd8ef3dea Enable conditional directives by default.
R=brianwilkerson@google.com, iposva@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1851753002 .
2016-04-14 19:02:41 +02:00
Erik Ernst 377b806bbc Adds support for remaining generic method syntax constructs.
CL https://codereview.chromium.org/1863053003/ added support for most
syntactic constructs in relation to generic methods/functions, and
this one adds the missing ones: Declarations of function typed arguments
with type parameters, declarations of generic local functions, and
declarations of generic literal function expressions. It also adds
support for `super` bounds, because they were discussed recently and
may be quite useful (and it turns out to be no problem to parse them).
Finally, a new test file is added to tests the additional constructs.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1878253002 .
2016-04-14 15:25:44 +02:00
Erik Ernst 4dd22a87bb Adds tests for syntactic support for generic methods.
This CL adds tests for syntactic support for declaration of type
parameters on methods and named functions, and for passing actual type
parameters in invocations.

The status files declare all the tests to be `CompiletimeError`s
(there is no support for `// AnalyzerOptions=`, so no `--options=..`
can be passed to `dartanalyzer`, even though it does succeed with
`--options=tests/language/X.options` where `X` is the name of the
test).

BUG=
R=brianwilkerson@google.com, leafp@google.com, regis@google.com

Review URL: https://codereview.chromium.org/1779173003 .
2016-03-11 10:27:37 +01:00
Bob Nystrom cb7aa02116 Type check for-in statements.
This does nominal checking on the iterable expression used in a for-in
statement:

1. It must implement Iterable.
2. The type argument to Iterable must be assignable to the variable's
   type.

R=brianwilkerson@google.com, jmesserly@google.com

Review URL: https://codereview.chromium.org/1771153002 .
2016-03-08 11:25:49 -08:00
Jacob Richman 6a0b321026 Allow factory constructors on mixin classes.
This mitigates a breaking change impacting real users caused by 851b4a995c.
The spec will be updated to allow factory constructors on mixins.

R=gbracha@google.com, iposva@google.com

Review URL: https://codereview.chromium.org/1699233002 .
2016-02-22 10:19:49 -08:00
Paul Berry 4896fea5f5 Add shared tests demonstrating bugs #25624, #25625, and #25626.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1653833002 .
2016-02-01 08:14:00 -08:00
Paul Berry 87c6790bb9 Add tests demonstrating bug #25605.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1650783002 .
2016-01-31 05:43:02 -08:00
Paul Berry 6590cc26c4 Add shared tests demonstrating bug #25614.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1646343002 .
2016-01-29 10:23:03 -08:00
Matthias Hausner 851b4a995c Compile-time error if mixin class has a factory
The VM now reports the location of the mixin application as well as
the location of the illegal constructor in the mixin class.

Update test language/mixin_illegal_constructor_test to follow the spec.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1638923002 .
2016-01-26 12:43:48 -08:00
Paul Berry afc2c880a6 Restore old supermixin functionality to shared language tests.
In 451eaab718 the "--supermixin" flag was
removed from the VM and from the shared language tests.  This caused
those language tests to fail on analyzer (because analyzer still
requires the flag).

Also some tests that validated the non-supermixin behavior were deleted.

It looks like we are going to keep requiring the flag in analyzer until
the feature is implemented in dart2js (see
https://github.com/dart-lang/sdk/issues/24478#issuecomment-170054303).
So in order to ensure that the analyzer implementation continues to be
tested, we still need the flags in the tests.  We also need the old
tests that validate the non-supermixin behavior, since the analyzer
continues to implement that behavior when the "--supermixin" flag is
absent.

This CL does not introduce any new VM failures, because (a) the VM
ignores the "--supermixin" flag, so the tests in which the flag is being
reintroduced will still behave the same way on the VM, and (b) the tests
that validate non-supermixin behavior are disabled on the VM.

R=brianwilkerson@google.com, regis@google.com

Review URL: https://codereview.chromium.org/1635763003 .
2016-01-26 08:50:21 -08:00
Matthias Hausner 82735da84d Remove obsolete test
built-in identifiers are no longer permitted as prefixes.

TBR=gbracha

BUG=6970

Review URL: https://codereview.chromium.org/1625733002 .
2016-01-22 16:00:19 -08:00
Matthias Hausner f32e0ce74c Fix test expectation for deep recursion tests
BUG=

Review URL: https://codereview.chromium.org/1621783002 .
2016-01-22 09:47:15 -08:00
Matthias Hausner 783cc8acae Parser recursion check
Let the parser issue a compile-time error when the C stack is about to overflow, instead of crashing the VM.

BUG=24476
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1620493002 .
2016-01-22 08:59:45 -08:00
Paul Berry c320b26e09 Introduce language test for bug #25525
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1595103003 .
2016-01-19 09:14:46 -08:00
Lasse R.H. Nielsen 2d44ed69e9 Implement (partially) ?? being compile-time constant in analyzer.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1577293002.
2016-01-14 16:17:52 +01:00
Lasse R.H. Nielsen fd59c87146 Make ?? a compile-time constant operator.
Update specification, change analyzer, VM and dart2js.

Fixes issue #25054.
BUG= http://dartbug.com/25054
R=floitsch@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org/1493693002 .
2016-01-12 12:30:07 +01:00
Matthias Hausner 8293e9665b Fix owner of mixin forwarding constructors
Not sure why the new test appears to be a change to existing files, rather than an new files. I'm too dumb for git.

BUG=25246
R=regis@google.com

Review URL: https://codereview.chromium.org/1533823004 .
2015-12-17 14:16:40 -08:00
Florian Loitsch af4983c6b2 dart2js: add support for configuration-specific imports.
R=johnniwinther@google.com, rnystrom@google.com

Committed: https://github.com/dart-lang/sdk/commit/64edfaf21af3153f32e1229dd97c9b3d40cbfb2b
Reverted: https://github.com/dart-lang/sdk/commit/f38b810d334900317ee6c919b45ebd0c673fdb02

Review URL: https://codereview.chromium.org/1388523002 .
2015-12-11 06:17:15 +01:00
Johnni Winther a48dbfefd8 Static/instance getter/setter override is a warning.
Closes #11496

R=karlklose@google.com

Review URL: https://codereview.chromium.org/1508343002.
2015-12-09 11:57:20 +01:00
Johnni Winther c9a1e1c1b1 Update analyzer status.
BUG=

Review URL: https://codereview.chromium.org/1510753003.
2015-12-08 12:00:07 +01:00
Sigmund Cherem 346e0da5db Fix status files: this marks a new test with the correct expectations for
analyzer, and it adds a temporary suppression for a co19 test (tracked in issue
25111).

Review URL: https://codereview.chromium.org/1494383002 .
2015-12-03 18:19:50 -08:00
Brian Wilkerson cc8f64b824 Do not generate warnings when noSuchMethod is inherited (issue 24337)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1414003003 .
2015-10-20 10:35:53 -07:00
Paul Berry e34b7ddf00 Pull in analyzer_cli support for enabling the new task model.
Note that we are not pulling in the latest version of analyzer_cli,
since there is additional work to do in analyzer_cli before the pull
request can be merged into master (in particular, lint support needs to
be fixed--see https://github.com/dart-lang/analyzer_cli/pull/67).
Instead we pull in the commit from the pull request itself, which
enables the new task model but makes no other changes.

R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1386233002 .
2015-10-06 14:25:22 -07:00
Regis Crelier 451eaab718 Remove --supermixin flag from VM.
Update tests and test status files.

Fixes #24479.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1383923002 .
2015-10-01 18:04:31 -07:00