Commit Graph

1931 Commits

Author SHA1 Message Date
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
Vijay Menon efe2c612b4 Clean up unused conversions
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/130197013
2014-12-18 10:23:39 -08:00
Sigmund Cherem 8f297f4e44 Include dynamic invoke in summary
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/130157013
2014-12-18 09:08:52 -08:00
John Messerly 37870d5f2e implement string interpolation
R=justinfagnani@google.com

Review URL: https://chromereviews.googleplex.com/129337014
2014-12-17 16:45:57 -08:00
John Messerly 9774313c4d sunflower works
some hacks for our lack of corelib, but otherwise it works now.

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/133857013
2014-12-17 14:45:04 -08:00
Sigmund Cherem 2eb2cbec76 pass cache-size option to analyzer
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/129917014
2014-12-17 14:43:01 -08:00
John Messerly 050dfd037b make cascades be expressions. This was bothering me from previous CL but didn't get to fix :). Codegen is now based on JS comma expression.
For now I ripped out the temp machinery. With the current writer there's no easy way to put the variable declaration in the right place. We can revive it when we have something, like the NestedPrinter from source_maps pkg. For now cascades are only generated when the target is a simple identifier. (That too is wrong in the case of getters, with multiple evaluations, but it's less wrong. At least we don't mess up the syntactic structure of the generated output.)

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/128587013
2014-12-17 14:07:02 -08:00
Leaf Petersen fa5cbce3fd Initial cut at new typing rules
BUG=
R=sigmund@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/124467014
2014-12-17 11:02:25 -08:00
Vijay Menon 98a09e483b Fix IDE warnings
Review URL: https://chromereviews.googleplex.com/129267013
2014-12-17 09:13:00 -08:00
Vijay Menon cd1cef975b Fix dart gen bug
Dart generation is breaking on me without this change.

TBR=leafp@google.com

Review URL: https://chromereviews.googleplex.com/134737013
2014-12-17 08:27:14 -08:00
Leaf Petersen 18fbab2545 Eliminate useless class assignment from some tests
BUG=
R=sigmund@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/132907013
2014-12-16 16:28:52 -08:00
Sigmund Cherem 288d73fcba A couple fixes in the checker:
- report analyzer errors earlier (before we are processing a unit)
 - fix checks for redirecting and super constructors.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/132017013
2014-12-16 16:18:29 -08:00
Sigmund Cherem 05325084f9 Fixex #5 (fix inference when expression is null)
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/128507013
2014-12-16 16:06:53 -08:00
Leaf Petersen e7f2cf2c0d Delete dynamization code.
BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/127497013
2014-12-16 14:52:20 -08:00
John Messerly 0493ac3271 initial sunflower changes
still some things unimplemented, but since we're all hitting the same paths figured I'd land what I have so far

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/125537013
2014-12-16 14:10:08 -08:00
Sigmund Cherem 706c749203 Initial changes to report some summary data from the checker.
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/130017014
2014-12-16 10:38:17 -08:00
Leaf Petersen 89da130295 More typechecker tests, support for failing tests
This CL adds support for marking tests as known failures using the following syntax:

/*expectation1::shouldbe::expectation2*/

where expectation is either "level:StaticInfo" as before, or "pass".

The meaning is that the test is currently exhibiting incorrect behavior expectation1, but should exhibit behavior expectation2.

The test will succeed so long as expectation1 is matched, but a summary of the number of "shouldbe" expectations is printed at the end of running the test script.  Currently this is just implemented as grep, we can make this fancier eventually.

I'm not particularly attached to the syntax, feel free to suggest alternatives.

This CL also adds a bunch of fairly mechanical tests of subtyping, a number of which we are definitely failing, and some of which we may or may not be failing depending on where we wish to insert automatic fixup code.

BUG=
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/129027013
2014-12-16 10:30:13 -08:00
Sigmund Cherem 2a9588da40 report errors found by analyzer too.
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/131967013
2014-12-15 19:27:58 -08:00
Justin Fagnani c96dd0db5a Codegen: implement assignment 2014-12-15 08:29:32 -08:00
Justin Fagnani 21258849ab Codegen: Prefix identifiers with ‘this’ when necessary. 2014-12-15 08:08:46 -08:00
Justin Fagnani 9a4965d76d Codegen getters and setters 2014-12-13 17:22:37 -08:00
Kevin Moore fc9f071638 Removed unused members, fixed type on infoTypes
R=jmesserly@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/126507013
2014-12-12 19:00:11 -08:00
Justin Fagnani 6354d7e516 Generate methods 2014-12-12 16:41:31 -08:00
John Messerly cce448c52f remove unused AstNode return value
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/132787013
2014-12-12 15:24:34 -08:00
John Messerly d8863611dc adds command line help to dartdevc
BUG=
R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/125447013
2014-12-12 14:15:01 -08:00
John Messerly 31825bb8b4 Rewrite the tree to include conversion nodes. This simplifies consumers
such as the code generators. Includes visiting capabilities too, so it's
easy to view these nodes if you want, but otherwise they are totally
transparent to the visitor.

R=leafp@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/125377013
2014-12-12 10:39:20 -08:00
Sigmund Cherem 2abc79389f Random cleanups
BUG=
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/130857013
2014-12-11 18:17:06 -08:00
Sigmund Cherem 19a59bb80f rename emitter to codegen
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/126387013
2014-12-11 17:15:10 -08:00
Sigmund Cherem 1c6787f47c Run the latest formatter on all files.
R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/130817013
2014-12-11 16:33:01 -08:00
Sigmund Cherem d4b32b5838 Add again some files I dropped
BUG=

Review URL: https://chromereviews.googleplex.com/131747013
2014-12-11 15:16:10 -08:00
Sigmund Cherem 02a4650a24 Refactor: move code around a bit
- bin/
    devc.dart

- lib/
    devc.dart

    src/
       info.dart # static info we compute, used by checker & backends
       checker/  # implementation details for the checker
          checker.dart  # checking algorithm
          rules.dart    # type checking rules
          resolver.dart # same as today, type resolution via analyzer
       emitter/
          ...
- test/
     checker/    # unit tests for the checker internals
     codegen/    # left as is - maybe should rename to emitter?
     samples/    # stand alone samples that we run in the end_to_end tests.
     ...

R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/128957013
2014-12-11 15:13:54 -08:00
Leaf Petersen eef8c94795 Skeleton for new checker and dart backend
This adds a skeleton new type checker which just reuses the existing checker for now, but will be filled in with the new type rules.

It also adds a dart backend code generator which currently just spits out the original dart code unchanged (except for (lack of) formatting) into the output directory.  By default it uses the dart_style formatter to format the output.  This sometimes hits issues, so there is an option to turn this off.

There are flags to control the various options added.

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

Review URL: https://chromereviews.googleplex.com/128857013
2014-12-11 13:01:01 -08:00
Vijay Menon 4b70cc73f3 Implement return
Trying out the new codegen tests - nice!

R=jmesserly@google.com

Review URL: https://chromereviews.googleplex.com/132697013
2014-12-11 12:32:50 -08:00
John Messerly c3fdc6e570 Introduce SemanticNode type in place of List<StaticInfo>
R=sigmund@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/122327013
2014-12-10 12:57:17 -08:00
John Messerly 3124c7ec89 add the ability to easily test codegen by diffing against expected output
this makes changes easy to spot

some of this code was taken from old polymer.dart test scripts :)

R=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/121567013
2014-12-09 16:52:05 -08:00
John Messerly 5d4f190e63 autoformat with dartfmt. This CL is entire automated.
I filed a few issues:
https://github.com/dart-lang/dart_style/issues/61
https://github.com/dart-lang/dart_style/issues/62

...but they aren't blocking, so I left our long comments (62) and one slightly odd formatting (61) as is.

R=sigmund@google.com, vsm@google.com

Review URL: https://chromereviews.googleplex.com/120127014
2014-12-08 19:58:35 -08:00
Vijay Menon 3c82dc4e16 Runtime type tests
This isn't quite right yet - it's in between our current static rules
and what we've been discussing changing.  Will fix up more tomorrow,
but wanted to put this out for initial feedback.

R=leafp@google.com

Review URL: https://chromereviews.googleplex.com/117167015
2014-12-08 15:09:21 -08:00
Vijay Menon 86026d8258 Fix pubspec
TBR=sigmund@google.com

Review URL: https://chromereviews.googleplex.com/129647013
2014-12-08 10:44:00 -08:00
Sigmund Cherem 09fd9268c1 integrate our typing rules with analyzer engine
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/123457013
2014-12-08 10:28:26 -08:00
Sigmund Cherem dfd1237146 Simplify how we discover libraries in the checker.
R=vsm@google.com

Review URL: https://chromereviews.googleplex.com/125187013
2014-12-08 09:15:22 -08:00
Justin Fagnani 3546759833 More constructor codegen:
* constructor parameters
* named constructors
* initializer lists
* superclasses and super constructor calls
2014-12-05 15:21:28 -08:00