Commit Graph

76 Commits

Author SHA1 Message Date
Peter von der Ahé 5b94cfe33a Various infrastructure changes.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2917863003 .
2017-06-01 15:16:18 +02:00
Mike Fairhurst bffe47e678 First stab at #29153 range check in as-casts. Mostly working.
Having an issue forwarding Symbol::InTypeCheck into dart and back;
without it, the exceptions that are thrown are `TypeError`s and not
`CastError`s.

Certainly a bit longform to read, as well.

Committing for feedback/suggestions/help

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2805903004 .
2017-04-13 10:44:57 -07:00
Mike Fairhurst 761d21d414 Fix #14144 confusing error message misusing a callable object
New tests to make sure that:
* Error message calling a closure wrong is unchanged
* Error message calling a static function wrong is unchanged
* Error message calling a callable object wrong is unchanged
* Error message calling nonexist method is unchanged
* Error message calling nonexist method for a callable object is clearer

The new tests involving calling a closure wrong exposed a bug in the
inliner, it assumed (due to lack of ic data, it seems) that all closures
have the right number of arguments. Left that assertion/behavior, but
put a guard around closures specifically (since static and method calls
don't have that bug, due to I think better ic data).

Welcoming myself to the world of VMs.

BUG=
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2785623004 .
2017-03-31 15:09:02 -07:00
Jacob Richman 4360e99d18 Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Committed: https://github.com/dart-lang/sdk/commit/62be0eacfbb36bdc92a05c7c35bb4506621b6a3a
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman 62be0eacfb Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman 88f8aacd5f Re-apply rolled back CL to apply dartfmt to runtime.
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak ea4744a06f Revert "Run dartfmt on all files under runtime."
This reverts commit 15f393f189.

The change caused many service test failures due to changed line numbers.

TBR=jacobr@google.com

Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Jacob Richman 15f393f189 Run dartfmt on all files under runtime.
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
Peter von der Ahé ab45caba0f Fix errors in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2717573003 .
2017-02-27 08:55:17 +01:00
John McCutchan 1660cab84d Skip the type test for expressions which have already evaluated to true or false.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2667353003 .
2017-02-02 11:58:29 -08:00
Kevin Millikin 50348f5f22 Fixes to patch files necessary to use the analyzer
The analyzer has a stricter patch parser than the VM.  Patch files
cannot change signatures of patched members.  Specifically, they cannot
change:

  - the return type
  - a parameter's name
  - a parameter to an initializing formal
  - an optional parameter's default value

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2612043002 .
2017-01-05 12:23:51 +01:00
Kevin Millikin f7b6f0cf1c Make the VM's dart:core and dart:async library patches clean.
Clean up the VM's dart:core and dart:async library patches so that
they are clean according to the patching rules implemented in the
analyzer.  Specifically:

  - If a member is patched in a patch file, it must be declared external
    in the SDK.

  - If a member is introduced in a patch file, it must be private.

  - A non-private superclass member cannot be overridden in a patch
    file.

BUG=
R=lrn@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2563633002 .
2016-12-15 10:10:09 +01:00
Matthias Hausner 2c0b605a96 Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

BUG=#24215
R=regis@google.com

Review-Url: https://codereview.chromium.org/2574003003 .
2016-12-14 11:05:19 -08:00
Matthias Hausner 156fdef01d Revert "Add optional message argument to assert statements in the VM."
This reverts commit 67e83dd79d.

BUG=

Review-Url: https://codereview.chromium.org/2558993005 .
2016-12-09 09:50:27 -08:00
Matthias Hausner 67e83dd79d Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

Fixes issue #24215
BUG= http://dartbug.com/24215

This replaces Lasse’s CL  1307363005

patch from issue 1307363005 at patchset 140001 (http://crrev.com/1307363005#ps140001)

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2564623003 .
2016-12-09 09:25:58 -08:00
Vyacheslav Egorov 23fd1a184b VM: Support bootstrapping core libraries from Kernel binaries instead of source.
BUG=http://dartbug.com/27590
R=asiva@google.com

Review URL: https://codereview.chromium.org/2485993002 .
2016-11-16 13:56:20 +01:00
Florian Schneider 2a40a14c7a Improve noSuchMethod error message for type objects.
This CL improves the message when trying to invoke 'call' on _Type objects. This often happens
when 'new' is forgotten ("C()" instead of "new C()")

Fixes #27651.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2507493003 .
2016-11-15 15:20:17 -08:00
Vyacheslav Egorov eb8c24e133 Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451623006 .
2016-10-27 10:09:22 +02:00
Vyacheslav Egorov 12968edb9c Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork.""
This reverts commit 4e7a31262e.

Windows bots are broken now.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451893004 .
2016-10-26 17:07:18 +02:00
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02:00
John McCutchan 7fd9df4d91 Improvements to NoSuchMethodError.toString
This makes the following improvements:

* Always show the call that was made, with arguments.
* ...and show the actual arguments in more cases.
* Be less confusing in the case of a call on the null receiver.
* Be less redundant in the output.
* Report when a constructor is called with the wrong number of arguments.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2405353002 .
2016-10-12 09:52:51 -07:00
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
Lasse R.H. Nielsen 99439a336a See: https://docs.google.com/document/d/1iEuLbDMgbB657R5aFj9EfnT6B0obzQk93Of7CfWKc00/edit#heading=h.9ixvz54wwawi
Implement assert in initializer list in VM.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2002923002 .
2016-08-24 12:43:26 +02:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Matthias Hausner 98033d4132 Simplify generated code for assert()
Move the assert condition check and throwing the error into
the Dart library. This eliminates one call to library code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2073623002 .
2016-06-16 10:44:30 -07:00
Lasse R.H. Nielsen c56411d576 Make VM accept function values in assert statements.
Fix for issue #18454.

BUG= http://dartbug.com/18454

Review URL: https://codereview.chromium.org/2064663002 .
2016-06-15 10:08:39 +02:00
Ivan Posva 3884fd4e4b - Allow for loading dart:html and friends into the standalone
dart_bootstrap binary to evaluate startup and compilation
  performance.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1916793003 .
2016-05-03 20:33:14 -07:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
Srdjan Mitrovic d503d2f0ed Added full deferred loading semantic to precompiled/--noopt/eager-loading code (some corner cases, e.g., compile-time errors for constants, still missing)
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211273011 .
2015-07-09 10:56:55 -07:00
rmacnak@google.com 327b85d956 Move symbol demangling to dart:_internal to remove dart:core dependency on dart:mirrors.
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45405 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 17:49:58 +00:00
hausner@google.com 392db8d312 Implement correct semantics of Boolean Conversion
When converting null to a boolean value, throw an AssertionError
rather than a TypeError.

This is the same change as r42145, with added co19 status updates.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42170 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-08 18:51:48 +00:00
hausner@google.com 4cfdf02012 Revert r42145 to fix co19 tests
Review URL: https://codereview.chromium.org//772513003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42148 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-05 21:05:38 +00:00
hausner@google.com ad837a0d9f Implement correct semantics of Boolean Conversion
When converting null to a boolean value, throw an AssertionError
rather than a TypeError.

Fixes issue 21279.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42145 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-05 20:36:37 +00:00
lrn@google.com e8ca26953e Reduce foot-print of Error.safeToString on strings.
Use existing JSON encoding instead of a custom encoding.
This allows dart2js to use the system JSON stringifier directly.

R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41704 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-13 06:47:17 +00:00
iposva@google.com c7c9d5d12f Fix http://dartbug.com/21335
- Make the VM internal AssertionError, TypeError and CastError implement
  the public classes instead of patching them.

R=asiva@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41231 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-21 17:00:16 +00:00
rmacnak@google.com da3b61d764 Add missing demangling to the VM's NoSuchMethodError. Ensure the VM's NoSuchMethorErrors for reflective invocation match those for non-reflective invocation.
Fix bug in VM demangling of setters.
Fix bug where test was not covering invocation on classes as intended.

BUG=http://dartbug.com/18042
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37294 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 22:53:00 +00:00
regis@google.com dec11d8b7b Add support for javascript incompatibility warnings (work in progress).
For now, warnings are only issued when applicable for type tests, type casts,
and toString.
Fix newly reported lint errors.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36001 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-09 22:42:10 +00:00
hausner@google.com ad3fb79210 Better error message for assignment to final local variables
“No top-level getter found” becomes “cannot assign to final variable xxx”.

Fixes issue 16782.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33028 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-25 18:01:35 +00:00
lrn@google.com 3b3e87cabc Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

Committed: https://code.google.com/p/dart/source/detail?r=31827

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31877 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 12:06:38 +00:00
lrn@google.com ead87f47e9 Revert "Rename internal library dart:_collection-dev to dart:_internal."
Dartium needs updating too.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31827 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 12:27:44 +00:00
lrn@google.com 0098710559 Rename internal library dart:_collection-dev to dart:_internal.
BUG= http://dartbug.com/14140
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31823 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-15 09:24:46 +00:00
regis@google.com e3da5e16e4 Check type bounds of redirecting factories (issue 14699).
Add tests for malbounded redirecting factories.
Clean up bound checking code and type error reporting code.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30177 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-11 22:59:48 +00:00
regis@google.com 3fa7a61efc Implement latest spec changes regarding malformed types (see issue 14006):
- a malformed type used in a is, as, or catch type test results in a dynamic
  type error being thrown.
- a malformed type is not mapped to dynamic anymore.

For now, this applies to type tests in checked mode as well, but discussion is
still on-going.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29608 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 23:30:32 +00:00
hausner@google.com e02652a123 Throw CyclicInitializationError instead of string
For some reason, I had to regenerate the snapshot for test standalone/issue14236_source.dart. The checked-in snapshot crashed with my change. We don't know yet why. Siva is looking at this separately.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29397 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 21:38:57 +00:00
iposva@google.com d369b7a0c9 - Ensure that the token stream from generated source matches the
original token stream in the presence of combinations of
  multiline string and string interpolation. If not this will
  cause mismatches when accessing code snippets, e.g when
  reporting parser errors or assertions.
- Ensure that ScanAll and ScanTo are in sync when adding or
  counting tokens.
- Added unit test for multiline strings and interpolation.
- Expanded GenerateSource unit test to iterate through all
  loaded libraries.
- Do not report columns for compilation errors in snapshotted
  code.
- Do not report columns from exceptions and errors when dealing
  with snapshotted code.
- Remove length field from TokenDescriptor. It was unused.
- Remove TokenStream::ComputeTokenPosition. It was unused.

R=fschneider@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29110 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-23 19:08:36 +00:00
regis@google.com 9ec07853c5 Report correct error message in case of super invocation (fix issue 8208).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29042 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 22:12:07 +00:00