Commit Graph

42 Commits

Author SHA1 Message Date
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
regis@google.com 5a5edb7f0c Report use of malbounded interface in type test.
Fix language tests related to malbounded types (issues 14123, 14131, 14132).

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28943 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-21 19:49:19 +00:00
hausner@google.com 3c360399ee Improve NoSuchMethodError error messages
- Don't say there is no constructor with name X if there is one
  that has incompatible parameter list.
- Better error message when mismatched optional parameters are passed.
  (Prviously only the number of parameters was considered, but not
  names of named parameters for example.)

Fixes issue 6189.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27826 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 16:14:28 +00:00
lrn@google.com 8d66e5d8de Fix error message for NoSuchMethodError to not contain "Symbol".
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27004 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 09:33:37 +00:00
lrn@google.com 53dc9ba034 Change the field and constructor parameter types of NoSuchMethodError to Symbol.
The NSME uses strings for names. It should use symbols.

This change modifies the VM libraries only enough to make the signature change
not crash. It will probably need cleanup to ensure that symbols are passed
to the internal constructor directly, instead of strings that have to be
converted.

(Also fixes a type error in Map.fromIterable that was hit by the code).

BUG= http://dartbug.com/11190
R=ahe@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26985 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 05:57:49 +00:00
regis@google.com 09bcdc6d6d Fix VM implementation of CastError not to extend TypeError (issue 5280).
Remove non-compliant fields in various Error classes (issue 10144).
Remove implicit constructor when patching in a constructor (issue 12217).
Patch corelib Error classes instead of declaring subclasses.
Update tests and status files.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25782 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-05 18:35:04 +00:00
zra@google.com 42add423d2 Fixes javascript integer overflow check.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25675 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 17:51:23 +00:00
asiva@google.com dcb6850f87 Fix for issue 11680
- implicitly store a full stack trace in Error objects when they are thrown.
- the shlFromInt on Mints and Bigints was trying to allocate a new OutOfMemory
  exception objects instead of using the pre-allocated exception object.
  Made the implementation of these methods native so that they can use the
  pre-allocated object.
- Ensure that it is not possible to allocate new OutOfMemory or StackOverflow
  exception objects.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25492 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 19:28:53 +00:00
rmacnak@google.com 1a0b3c7871 Make reflective invocations raise NoSuchMethodErrors in the cases where non-reflective invocations do so. Resolves issues 11187 and 11957.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25387 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 00:29:17 +00:00
floitsch@google.com 06493c3460 Revert "Introduce StackTraceOnThrowMixin."
This reverts commit r24951.

R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25142 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-18 10:39:56 +00:00
floitsch@google.com e5cade9e88 Introduce StackTraceOnThrowMixin.
R=ahe@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24951 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 15:30:53 +00:00
floitsch@google.com 438767ca3a Add stackTrace to Error object.
BUG=
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24726 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-03 14:51:30 +00:00
lrn@google.com 64553c2774 Fix expectation for 53-bit-overflow.
Make variable in error private.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24274 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 09:11:14 +00:00
lrn@google.com 0c90061029 Move FiftythreeBitOverflowError to VM-only patch file.
The class is not meaningful in the core library, and should go away once
dart2js has integers.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24265 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 07:31:48 +00:00
srdjan@google.com 706e79d074 Fix error reporting when calling static methods and closures withh mismatched arguments.
Closures BEFORE:
----
Unhandled exception:
Class '(dynamic, dynamic, dynamic) => dynamic' has no instance method 'call'.

NoSuchMethodError : method not found: 'call'
Receiver: Closure: (dynamic, dynamic, dynamic, dynamic) => dynamic from Function 'foo':.
Arguments: [2]

Closures NOW:
----
Closure call with mismatched arguments: function 'A.foo'

NoSuchMethodError: incorrect number of arguments passed to method named 'A.foo'
Receiver: Closure: (dynamic, dynamic, dynamic, dynamic) => dynamic from Function 'foo':.
Tried calling: A.foo(2)
Found: A.foo(a, b, c)


Statics BEFORE:
----
Unhandled exception:
No top-level method 'foo' declared.

NoSuchMethodError : method not found: 'foo'
Receiver: Type: class '::'
Arguments: []

Statics NOW:
----
Unhandled exception:
No top-level method 'foo' with matching arguments declared.

NoSuchMethodError: incorrect number of arguments passed to method named 'foo'
Receiver: top-level
Tried calling: foo(...)
Found: foo(a, b, c)

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22209 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-30 22:05:14 +00:00
iposva@google.com 2fb7cf7220 - Print "top-level" instead of "class '::'" in
NoSuchMethodErrors.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22005 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 07:29:06 +00:00
lrn@google.com 844cd39fad Change getRange to sublist. Make getRange deprecated.
This changes the exception behavior of getRange. It used to accept
a length of zero, no matter what start value. Now the start value
must be a valid list index.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20064 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-15 09:15:39 +00:00
floitsch@google.com dd48256fe5 Remove deprecated StringBuffer.add, addAll and addCharCode.
Review URL: https://codereview.chromium.org//12473003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19690 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 13:07:18 +00:00
iposva@google.com c900112af7 - Improve the message for NoSuchMethodErrors that are
determined statically at compile time.
Review URL: https://codereview.chromium.org//12328019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18848 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 18:53:27 +00:00
iposva@google.com f6c5bcec42 - Split the implementation of NoSuchMethodError in preparation for
better error messages from the VM.
Review URL: https://codereview.chromium.org//12297010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18614 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-18 07:00:53 +00:00
regis@google.com cb27634842 Remove NoSuchMethodErrorImplementation class and use NoSuchMethodError from core
lib instead.
Review URL: https://codereview.chromium.org//11712002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16583 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-02 18:52:28 +00:00
lrn@google.com 3450798a1d Make Exception a class, not an interface, and remove the const constructor.
We should consider removing the constructor entirely, there is never a good excuse for throwing a non-descript Exception. If you do, it should likely be an Error instead.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15077 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 13:23:23 +00:00
regis@google.com ec09038e82 Remove references to ObjectNotClosureException and ClosureArgumentMismatchException
from the VM (issue 6124).
These are replaced with NoSuchMethodError for now (work in progress).
Review URL: https://codereview.chromium.org//11312019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14362 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 18:13:12 +00:00
lrn@google.com bc7f07ae86 Move ObjectNotClosureException and ClosureArgumentMismatchException to patch file.
They are no longer available in the core library, and are only used by the VM.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13992 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 06:17:21 +00:00
ahe@google.com 3f1932a563 Handle backslashes and newlines when escaping strings.
Review URL: https://codereview.chromium.org//10943027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12568 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 15:43:41 +00:00
ahe@google.com d0f3e48063 Work around for bug 4995 to unbreak VM build.
Review URL: https://codereview.chromium.org//10947026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12541 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 09:00:38 +00:00
ahe@google.com 34c503ae73 Don't invoke user-defined code in NoSuchMethodError.toString.
Review URL: https://codereview.chromium.org//10939020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12533 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 07:55:50 +00:00