Commit Graph

2821 Commits

Author SHA1 Message Date
Vijay Menon 4a8c10f58c Initial support for runtime logging
This is very half baked.  Putting it down to work on better type literal support for the moment.

Qs:
(1) What should we measure?  cast failures mapped back to source?  I don't think we inject anything else right now.
(2) How should we report?  I just have dump function right now, but that'll be unwieldy on large apps.

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

Review URL: https://chromereviews.googleplex.com/146737013
2015-01-26 10:51:38 -08:00
John Messerly b9fce8ad51 add lazy fields, cleanup library identifiers
R=leafp@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/146777014
2015-01-26 10:25:45 -08:00
Vijay Menon 9e7634e0e6 Support for generic 'literals' in dart checks
Jacob, Siggi, and I were discussing something like this yesterday morning as a way to write List<String>.  Hacky, but does allow for inline checks.

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/143037014
2015-01-23 10:01:19 -08:00
John Messerly c9d86483ef rename dart_runtime to dart
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147667013
2015-01-22 11:09:21 -08:00
John Messerly 69add413d2 add work-in-progress deltablue
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/147607013
2015-01-22 09:49:48 -08:00
John Messerly 411803ffd4 don't use deprecated constant visitor
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/145987013
2015-01-21 15:51:26 -08:00
Vijay Menon 5e6edcbade Support covariant generics at runtime
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/142887013
2015-01-20 14:53:15 -08:00
John Messerly 6f58b51389 add test for field order
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/137317015
2015-01-20 13:24:13 -08:00
Sigmund Cherem 33e1aa1313 Rerun formatter, remove unused import
BUG=
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/137587013
2015-01-16 08:34:24 -08:00
Sigmund Cherem 7592e0e9e9 Cleanup on invalid overrides logic. THis is a follow up with Leaf's comments.
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/143757013
2015-01-16 08:24:40 -08:00
Sigmund Cherem 6effcffa67 Check for invalid method overrides between interfaces, base classes, and mixins.
Closes #13

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/138367013
2015-01-15 17:43:49 -08:00
Sigmund Cherem 7732dd9d8e Provide better error messages when files are not found
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/141947013
2015-01-15 14:23:22 -08:00
John Messerly c350bb7816 use harmony features in js codegen, including classes
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/138327013
2015-01-14 14:35:50 -08:00
John Messerly 102fcb9d20 small cleanup to the writer
The contract around indentation should be tighter now and easier to follow. This fixes cases that caused indent to be skipped.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/140867013
2015-01-14 12:26:22 -08:00
Vijay Menon 20cf4c9c4b Runtime arity helper function
We'll need to figure out an efficient way to do this in JS output.

An alternative, suggested by Jacob, is only provide something like an applyTruncated function.  E.g., something like:

dynamic applyTruncated(Function f, List args) {
  var arity = getArity(f);
  assert(args.length >= arity.min);
  args = args.sublist(0, arity.max);
  return Function.apply(f, args);
}

Jacob: is this what you have in mind?

If so, we could *only* provide this.  The dart2j impl could use the existing code pattern of is-checks.  The ddc implementation could map to JS apply (with a check for named params?).

Thoughts?

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/137047014
2015-01-13 17:55:44 -08:00
Leaf Petersen fcf7a98525 Call method subtyping
Allow objects with an appropriately typed call method to subtype function types.  Fixes #19.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/140757013
2015-01-13 16:10:48 -08:00
Leaf Petersen b8500e008c Tests for for loop inference. We haven't implemented inference for foreach loops, and don't seem to be propagating inferred types correctly for regular for loops. This CL adds some tests to document this.
BUG=
R=jmesserly@google.com, sigmund@google.com

Review URL: https://chromereviews.googleplex.com/136957014
2015-01-13 11:28:04 -08:00
John Messerly c8da19d3a2 for loop regression test, closes #20 and #21
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/139837013
2015-01-13 11:18:32 -08:00
Vijay Menon 77c4e1ac70 Fix num.+ in mock sdk
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/137437013
2015-01-12 17:31:34 -08:00
John Messerly 7a91b971a4 Check for valid super constructor call placement
Generated code can be cleaner if this rule is enforced

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/137157014
2015-01-12 14:35:46 -08:00
Leaf Petersen b0a7024e5d Formatter run
Run the formatter on the repository

BUG=
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/138207013
2015-01-12 13:16:35 -08:00
Vijay Menon 85f2c2ca5e Compound operator fixes
This permits:
 - double += int
 - int|double += num
 - int|double|num += dynamic

These used to be rejected.

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/138217013
2015-01-09 13:34:10 -08:00
Leaf Petersen 37752f763c Relaxed casts
Allow implicit sideways casts between types that are assignable in regular dart.

BUG=
R=jacobr@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/135247013
2015-01-09 10:22:29 -08:00
Vijay Menon 1b936601fb Differentiate wrapped closure literals and down casts on constructors
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/130427015
2015-01-09 05:55:42 -08:00
Vijay Menon b2d8299c94 Differentiate and report special down casts
- DownCastExact : Cases where the static type of rhs is exact
    List<int> l = [1, 2, 3];

- DownCastDynamic : Cases where the static type of the rhs is a subtype (in Dart) of the static type of lhs:
    List l = ...;
    List<int> l2 = l;

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/141647013
2015-01-08 15:57:12 -08:00
Leaf Petersen d44e64d22a Covariant generic support
Add support for full covariant generics, under a flag.  Using --covariant-generics will make the checker use full covariance for generics.

BUG=
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/140607013
2015-01-08 12:39:32 -08:00
Leaf Petersen efa7876cf2 Coercion reification, dart codegen URI rewriting, import fixups.
This CL adds a general reification pass which makes abstract coercions concrete by modifiying the ast.  Casts are reified as "as" expressions, and wrappers are reified by creating functions which take the old function as arguments and produce a new wrapped function.  There are a number of known issues not yet addressed:

1) No distinction between dart "as" and our special "as" is made yet.
2) Wrapper generation functions do not check for null arguments yet.
3) Types introduced via wrappers and "as" expressions are not yet added to the set of types for which new imports may be required.
4) Wrapper functions for non-literals can't be guaranteed not to change the runtime type without more backend support, since we only have their static type.

This CL also adds support for rewriting import directives in the dart backend to reflect the directory structure that we currently use for output.  Probably this should be rethought.  Currently I just use absolute file URIs, which is not what we want.

This CL also adds support for adding in the import directives needed to account for type names added via inference.  This is not yet correct for "part of" files, since we need to add the imports to the main library file.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/137957013
2015-01-07 13:53:16 -08:00
Vijay Menon 038fe00c08 Special case int and double operators per spec
I'll check the regular (non-compound) operators in a separate CL.  Doing this first as it is more likely to break us right now.

R=rnystrom@google.com

Review URL: https://chromereviews.googleplex.com/135207013
2015-01-07 12:03:29 -08:00
Jacob Richman 5114b93cc4 Include error messages
Merge branch 'master' of github.com:dart-lang/dart-dev-compiler

change git dependency so that the ssh keychain can save your username and password.

BUG=
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/136707014
2015-01-07 07:51:15 -08:00
Vijay Menon e47e358475 Added a test for operators
Filed here: https://github.com/dart-lang/dart-dev-compiler/issues/18

R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/139597013
2015-01-07 06:14:26 -08:00
Vijay Menon bb2c0b55f0 Check compound assignments
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/138637013
2015-01-06 16:21:43 -08:00
Vijay Menon 35bee75212 Fix analyzer / editor warning
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/131577013
2015-01-06 14:59:55 -08:00
Jacob Richman 981af2890a change git dependency so that the ssh keychain can save your username and password.
BUG=
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/137007013
2015-01-05 17:32:14 -08:00
Jacob Richman b4999ee290 Support writing error messages directly to file.
BUG=
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/134137013
2015-01-05 16:18:45 -08:00
Sigmund Cherem 65d8e95a2f Do proper path joining, so you can specify paths without the trailing '/'.
R=jacobr@google.com

Review URL: https://chromereviews.googleplex.com/131517013
2015-01-05 16:14:15 -08:00
Sigmund Cherem b43f006e7a Use digest parsing to discover sources and process them bottom-up
BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/131447013
2015-01-05 11:00:15 -08:00
Sigmund Cherem 6040082ca0 Run formatter: apply fixes for multilines, yay
R=rnystrom@google.com
BUG=

Review URL: https://chromereviews.googleplex.com/134097013
2015-01-02 17:22:30 -08:00
Kevin Moore 9ca3b75f05 fixes for analyzer hints: unused imports and duplicate library name
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/133217013
2014-12-29 18:35:02 -08:00
Sigmund Cherem 17e388ff48 Run formatter again after a couple bug fixes.
R=rnystrom@google.com

Review URL: https://chromereviews.googleplex.com/133227013
2014-12-29 17:39:30 -08:00
Sigmund Cherem c95d72647a Run latest formatter
Review URL: https://chromereviews.googleplex.com/131387013
2014-12-29 13:01:35 -08:00
Sigmund Cherem 29fe571af7 Remove InvalidFieldOverride and measure "Inferable overrides"
R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/136867013
2014-12-29 09:20:24 -08:00
John Messerly c5144ca325 remove SemanticNode
we didn't really need it after Siggi's reporting changes and introducing Conversion
(and it's trivial to check the "dynamic" bit in codegen)

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/131277013
2014-12-19 18:28:05 -08:00
Sigmund Cherem 4448f18cea Add a reporter, remove caching of source files and recording of info (in progress)
R=leafp@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/132767014
2014-12-19 15:10:38 -08:00
Leaf Petersen 83debda79e Closure wrapping, revamped coercions
This CL adds composite coercions which reify the choices made by the typechecker in allowing a closure wrapping as explicit casts and wrappers.  The code generators should now be able to just walk the coercion generating the appropriate code.  Thoughts or suggestions about the design of this very welcome.

The closure wrapping decision process has changed as well.  Instead of simply checking reverse subtyping (which allowed some closure wrapping which would change the runtime type), we now essentially do a more extended subtype check which allows downcasts (and a few other conversions) on arguments, and attempts to wrap or downcast the body.  This enables wrapping for a common pattern we have encountered in which an untyped (and hence dynamically typed) lambda is passed into a typed context.  It also allows closure wrapping for some cases that we may (or may not) prefer to reject, such as allowing an int -> int to be coerced to an Object -> Object and vice versa.

In follow up CLs, I will add a reifier which translates coercions to ast nodes, and will add some flags to try out different closure wrapping strategies.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/132147015
2014-12-19 14:54:01 -08:00
Leaf Petersen bfad23536f Allow casts at non-ground type
We have been rejecting "as" checks at non-ground type, but we can (and should) allow these (unlike "is", which we may have to restrict in some way).

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

Review URL: https://chromereviews.googleplex.com/128217016
2014-12-19 14:19:49 -08:00
Leaf Petersen 4a9746c0b7 Generic tests
This adds some checker tests for subtyping generics.  One test checks that generics are invariant in various ways, another checks that raw type subtyping works, and the last test covers multiple raw type subtyping for multiple parameter generics.

For the last test, it's not clear that this is the behavior that we want, but it's what's currently implemented.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/130137014
2014-12-18 15:49:52 -08:00
Leaf Petersen 72b10800a5 Fix some function subyping bugs, add tests
We were getting some corner cases of function subtyping in the presence of named and optional parameters wrong.  This CL fixes the function subtyping method, and adds a test for a range of cases.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/134847013
2014-12-18 15:21:20 -08:00
Sigmund Cherem 93bf92812e Add support for hierarchical packages and multiple package locations
BUG=
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/129377013
2014-12-18 14:26:29 -08:00
Vijay Menon 2cec8d57e7 Sort summary types
This happens to also group conversions on the left and errors on the right.

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/136757013
2014-12-18 14:00:03 -08:00
Sigmund Cherem 5e18d8fa7e Fix tests with dynamic invoke warnings
R=vsm@google.com
BUG=

Review URL: https://chromereviews.googleplex.com/134837014
2014-12-18 11:05:13 -08:00