Commit Graph

31886 Commits

Author SHA1 Message Date
Asumu Takikawa
e52256b7f0 Avoid type-checking type annotation clauses 2014-02-20 16:50:26 -05:00
Asumu Takikawa
c8e5423e55 Make subtyping checks on objects faster 2014-02-20 16:50:26 -05:00
Asumu Takikawa
e80c4d72fb Fix augment type printing 2014-02-20 16:50:26 -05:00
Asumu Takikawa
7d7f23589f Allow polymorphic method types 2014-02-20 16:50:26 -05:00
Asumu Takikawa
45b8e17687 Add internal timing support for classes 2014-02-20 16:50:26 -05:00
Asumu Takikawa
7cc9b0ef12 Adjust local expansion to account for local macros 2014-02-20 16:50:26 -05:00
Asumu Takikawa
54bc1732da Increase named-based sharing of class types
This change makes serialized types much smaller when large
class types are used for type aliases. This shrunk the zo file
for the gui-types module from 12MB to 220KB.

If large zo files are a problem elsewhere, this may be worth
doing for more types.
2014-02-20 16:50:26 -05:00
Asumu Takikawa
37c1730bb3 Add support for in-line class polymorphism 2014-02-20 16:50:26 -05:00
Asumu Takikawa
3c044e23fd Reorganize functions for type parameters
This refactoring saves some lines and reduces the ridiculous
number of arguments for some helper functions. (using a hash
table instead of arguments) This will help for adding type
parameter name scoping later.
2014-02-20 16:50:26 -05:00
Asumu Takikawa
8ca8eb1642 Add support for separate augment/pubment interfaces
Now a class may have a pubment method that has a different
type for being directly called and for being specialized
for inner calls. This is actually necessary to type-check
interesting uses of pubment/augment.

Note that if a class does not provide a type annotation
for the augmentation interface, it will be assumed to be
the same as the pubment type.
2014-02-20 16:50:26 -05:00
Asumu Takikawa
f8212063b7 Refactor class type-checker 2014-02-20 16:50:26 -05:00
Asumu Takikawa
dbf9459e99 Use lists as sets for type-checking classes 2014-02-20 16:50:26 -05:00
Asumu Takikawa
ed94d35105 Improve error messages for superclass checks
Also add a test for the inherit-field case for this
2014-02-20 16:50:25 -05:00
Asumu Takikawa
c16ace02fa Add support for inherit-field 2014-02-20 16:50:25 -05:00
Asumu Takikawa
e25b24986f Fix a private/augment method issue 2014-02-20 16:50:25 -05:00
Asumu Takikawa
008e18a6b4 For classes, always check expected type against synthesized
This also enables depth subtyping for class types, which
was needed to get the tests to pass
2014-02-20 16:50:25 -05:00
Asumu Takikawa
37c313e9b3 Improve error messages 2014-02-20 16:50:25 -05:00
Asumu Takikawa
27a7322033 If no annotations are present, assume Any or Procedure
Note that for methods, if the type is annotated as
Procedure, TR will try to find a more precise type and
use that instead.
2014-02-20 16:50:25 -05:00
Asumu Takikawa
98b49deb76 Error on duplicate type annotations 2014-02-20 16:50:25 -05:00
Asumu Takikawa
0ef3f09768 Allow type annotations in class clauses directly 2014-02-20 16:50:25 -05:00
Asumu Takikawa
a6daafd70a Use class instead of class: for typed classes 2014-02-20 16:50:25 -05:00
Asumu Takikawa
91729c060c Add support for basic polymorphic classes 2014-02-20 16:50:25 -05:00
Asumu Takikawa
71d590604f Improve handling of expected type 2014-02-20 16:50:25 -05:00
Asumu Takikawa
e3efb90a59 Add expected error messages to class tests 2014-02-20 16:50:25 -05:00
Asumu Takikawa
86093f88be Fix contracts on TR functions 2014-02-20 16:50:25 -05:00
Asumu Takikawa
6cdc5fb720 Improve several type error messages
In particular, improve the syntax reported when the
method arity is wrong.
2014-02-20 16:50:25 -05:00
Asumu Takikawa
0d498e18e7 Enforce method types as function types in parsing 2014-02-20 16:50:25 -05:00
Asumu Takikawa
7ba8dd57cb Add a unit test for ill-typed private methods 2014-02-20 16:50:25 -05:00
Asumu Takikawa
eb95264e3f Support pubment and augment methods
This required changes to the type and row
representation. I also got rid of the redundancy
between Row and Class types.

Some other bugs had to be quashed for these
changes, such as private methods not actually
being type-checked.
2014-02-20 16:50:25 -05:00
Asumu Takikawa
1dede05549 Make type parsing error more informative 2014-02-20 16:50:24 -05:00
Asumu Takikawa
92e34ebab9 Fix class type subtyping
Although classes have no non-trivial subtyping relationships,
the representation I chose ends up introducing cases where two
"equal" types are not represented in the same way. This
commit fixes that by checking only the relevant parts of the
representation.
2014-02-20 16:50:24 -05:00
Asumu Takikawa
939c3bb4c8 Implement row polymorphism
- Refactor syntax classes and parsing for class types in
    order to accommodate constraints for row polymorphism
  - No contract generation, but other parts are implemented
2014-02-20 16:50:24 -05:00
Asumu Takikawa
884c898bfa Change #:extends to #:implements 2014-02-20 16:50:24 -05:00
Asumu Takikawa
c47531569a Add parsing for (Object ...) types into Instances 2014-02-20 16:50:24 -05:00
Asumu Takikawa
32f39ddff4 Improve object type printing
Use the `Object` constructor style instead of `Instance`
in cases where it makes sense.
2014-02-20 16:50:24 -05:00
Asumu Takikawa
081cc4777a Add syntactic sugar for recursive class types 2014-02-20 16:50:24 -05:00
Asumu Takikawa
a1efc2c276 Attempt to support recursive types in classes better 2014-02-20 16:50:24 -05:00
Asumu Takikawa
16ca57500b Remove debug displays 2014-02-20 16:50:24 -05:00
Asumu Takikawa
19b1ca17c6 Attempt to allow recursive types in objects/classes
Contract generation is not implemented correctly yet
since the static contract portion needs adjustment.
2014-02-20 16:50:24 -05:00
Asumu Takikawa
cc61f0639e Allow duplicate type names if they have the same type 2014-02-20 16:50:24 -05:00
Asumu Takikawa
f84cf996c3 Add "multiple inheritance" for class types 2014-02-20 16:50:24 -05:00
Asumu Takikawa
4543204e85 Don't add super-type inits into type with #:extends 2014-02-20 16:50:24 -05:00
Asumu Takikawa
bbd5d97a23 Support private fields 2014-02-20 16:50:23 -05:00
Asumu Takikawa
4559981212 Add super calls
(also removed bogus super-new init test)
2014-02-20 16:50:23 -05:00
Asumu Takikawa
ba70851ba0 Don't make mandatory super inits mandatory for super-new 2014-02-20 16:50:23 -05:00
Asumu Takikawa
f82a49be7d Fix type-checking for fields with this 2014-02-20 16:50:23 -05:00
Asumu Takikawa
6b5875a1f1 Fix subtyping for fields 2014-02-20 16:50:23 -05:00
Asumu Takikawa
5da60f7067 Make keyword methods type-check
Note: send does not work with keyword methods yet
2014-02-20 16:50:23 -05:00
Asumu Takikawa
4e5d0846ba Add support for inherited methods 2014-02-20 16:50:23 -05:00
Asumu Takikawa
30e3c49886 Attempt better error message for bad method type case 2014-02-20 16:50:23 -05:00