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
John Messerly
395e5c5b5e
fix sdk dir detection on mac
...
the homebrew version of Dart symlinks the SDK, now it can follow links like the dartanalyzer shell script can
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/126007014
2014-12-03 13:21:09 -08:00
Sigmund Cherem
21b9d6e6b3
fix analyzer warnings
...
R=jmesserly@google.com , vsm@google.com
Review URL: https://chromereviews.googleplex.com/119477013
2014-12-02 15:23:16 -08:00
Vijay Menon
e6b1853c40
Flesh out more codegen
...
R=jmesserly@google.com
Review URL: https://chromereviews.googleplex.com/126787013
2014-12-02 09:02:17 -08:00
Vijay Menon
a8897199fe
Cleanly separate static errors and conversions
...
R=leafp@google.com
Review URL: https://chromereviews.googleplex.com/126757013
2014-12-01 13:21:50 -08:00
Sigmund Cherem
89d3081aef
Add unitttest for the program checker
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/122177013
2014-12-01 12:27:54 -08:00
Vijay Menon
4223070e23
Fix subtyping bug on Function
...
This fixes a bug on when the checker is run on itself.
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/124057013
2014-11-26 11:21:03 -08:00
Vijay Menon
75530c08c9
Fix for return type handling
...
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/119237013
2014-11-26 08:12:10 -08:00
Vijay Menon
436c1f5448
Allow checks against dynamic
...
This allows "x as dynamic". Seems to be no reason to disallow this.
R=jmesserly@google.com
Review URL: https://chromereviews.googleplex.com/126607013
2014-11-25 20:55:59 -08:00
Sigmund Cherem
a8a7297e19
Another fix: resolve on every compilation unit.
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/116577014
2014-11-25 14:23:11 -08:00
Sigmund Cherem
d2a729cd68
Run resolver on every library, as we walk through them
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/115197015
2014-11-25 12:54:37 -08:00
Vijay Menon
2875cce4b3
Add support for ground type checks
...
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/121057013
2014-11-25 09:01:06 -08:00
Vijay Menon
08c74219d4
A couple fixes
...
- Handle expression returns (=>) in method declarations.
- Handle library prefixes.
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/117557013
2014-11-25 08:47:35 -08:00
Vijay Menon
f5cbd804dd
Check return types
...
R=leafp@google.com
Review URL: https://chromereviews.googleplex.com/118587013
2014-11-21 16:24:47 -08:00
Vijay Menon
fb69de4769
Fix analyzer error
...
Caught by run.sh.
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/123877013
2014-11-21 14:34:23 -08:00
Sigmund Cherem
971e551b6d
Use analyzer as a library, enable mock sdks, refactor to start testing
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/118577013
2014-11-21 14:24:06 -08:00
Vijay Menon
9da00a7add
Add reporting of unimplemented conversions in generated code
...
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/122037013
2014-11-21 13:52:10 -08:00
Vijay Menon
2116aa559b
transitive inference test
...
We're currently getting the first var, but somehow not transitively. If d1 is explicit typed, we don't see these dynamic invokes:
> dart ./bin/checker.dart -l info -o out tests/transitiveinfertest.dart
No issues found
#1 : line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b.a.x requires dynamic invoke
print(d1.c.b.a.x);
^^^^^^^^^^
#2 : line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b.a requires dynamic invoke
print(d1.c.b.a.x);
^^^^^^^^
#3 : line 21, column 9 of tests/transitiveinfertest.dart: d1.c.b requires dynamic invoke
print(d1.c.b.a.x);
^^^^^^
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/120937013
2014-11-21 13:48:40 -08:00
Sigmund Cherem
61b6c38f54
Infer type of local variables
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/121947014
2014-11-20 20:01:36 -08:00
Sigmund Cherem
688e45550f
Fixing analyzer warnings
2014-11-20 18:09:17 -08:00
Sigmund Cherem
210b2246b8
Add missing import in codegenerator
2014-11-20 18:04:07 -08:00
Sigmund Cherem
fa21bb85fa
Add missing imports - fixes the checker in checked mode
...
Review URL: https://chromereviews.googleplex.com/119987013
2014-11-20 17:58:33 -08:00
Sigmund Cherem
4c67c961ff
All minor nits: split some files up, fix comments in walker to remove references
...
to spec, make them more darty, run formatter on the rest of the files
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/117397013
2014-11-20 15:36:20 -08:00
Sigmund Cherem
560aa1f632
Fix span location to skip comments
...
R=vsm@google.com
Review URL: https://chromereviews.googleplex.com/120837013
2014-11-20 13:00:08 -08:00
Vijay Menon
8522221df4
Initial codegen skeleton
...
Invoke with:
> dart bin/checker.dart -o out tests/fieldtest.dart
Run with (node.js installed):
> node runtime/run.js runtime/dart_runtime.js runtime/dart_core.js out/fieldtest/fieldtest.dart.js fieldtest
Here's the output of fieldtest.dart.js:
var fieldtest;
(function (fieldtest) {
// Class A
var A = (function () {
var _initializer = (function (_this) {
_this.x = 42;
});
function A() {
_initializer(this);
}
return A;
})();
fieldtest.A = A;
// Function foo: (A) → void
function foo(a) {
dart_core.print(a.x);
}
fieldtest.foo = foo;
// Function bar: (dynamic) → void
function bar(a) {
dart_core.print(dart_runtime.dload(a, "x"));
}
fieldtest.bar = bar;
// Function main: () → void
function main() {
var a = new A();
fieldtest.foo(a);
fieldtest.bar(a);
}
fieldtest.main = main;
})(fieldtest || (fieldtest = {}));
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/119897013
2014-11-20 12:15:55 -08:00
Vijay Menon
d56614566e
Fix style
...
R=sigmund@google.com
Review URL: https://chromereviews.googleplex.com/118277014
2014-11-18 15:10:04 -08:00