Commit Graph

3389 Commits

Author SHA1 Message Date
Asumu Takikawa
07243dd154 Add static contract tests for classes
original commit: 39b237043d0d91058ac8cb041eb665f502b17590
2014-02-20 16:50:27 -05:00
Asumu Takikawa
10f04eb58e Convert parse tests w/ classes to use abbreviations
original commit: dff2fa6de78917848c121cc60264176fe2e7b851
2014-02-20 16:50:27 -05:00
Asumu Takikawa
3786645026 Disallow non-aliases in #:implements
original commit: 92d5e4a8aecbb9b121652f1e38c9bee76db64e0f
2014-02-20 16:50:27 -05:00
Asumu Takikawa
3a63c8175e Add abbreviation for classes and use in base-env
original commit: 98a2d248c0589e4b8d3663566adff7b66da6be6b
2014-02-20 16:50:27 -05:00
Asumu Takikawa
143c430632 Revise type for is-a?
original commit: 84e780174e0d827f6a4fc660f92525ca5bb71800
2014-02-20 16:50:27 -05:00
Asumu Takikawa
d70a59d5cb Add ClassTop type
Still TODO are better error messages when a ClassTop
is encountered for subclassing or instantiation.

original commit: e26742e736f59ebb4beada50dd813105de89948d
2014-02-20 16:50:27 -05:00
Asumu Takikawa
6eb16b9f2f Refactor part of class type system
original commit: afb141711406ed4f65de6f558afdd76f17524013
2014-02-20 16:50:27 -05:00
Asumu Takikawa
a7b4474b11 Add documentation for typed classes
original commit: 0a89b9b71817403ef9e24da59e48fa6368eca1c1
2014-02-20 16:50:27 -05:00
Asumu Takikawa
e93058db54 Check for unsupported class clauses and error
original commit: 66c1b10c189c06739b3c85fbb568b0d0859dee7d
2014-02-20 16:50:27 -05:00
Asumu Takikawa
b08abc4f48 Update type->contract for new class representation
original commit: 661a3714342c8268c8986ef1fbd7438bb3930e1a
2014-02-20 16:50:27 -05:00
Asumu Takikawa
c87dfbdf18 Rewrite class tests as standard TR typecheck tests
original commit: 02391fae9d5778a3d6b6659930d13ac3df22b588
2014-02-20 16:50:27 -05:00
Asumu Takikawa
24d2f84103 Allow depth subtyping with #:implements
original commit: bd5ec395c264971fe9c8f0ed2fbe5130cc406c56
2014-02-20 16:50:27 -05:00
Asumu Takikawa
72dd536f96 Parse-type fix for Instance types
original commit: 00bb21964247ebb774c2db4709b567adf16cc51a
2014-02-20 16:50:27 -05:00
Asumu Takikawa
fef7b7b508 Fix timing in class type-checking
(make sure the timing goes away if the flag is off)

original commit: ee3e83856c6f6973c29ada0c809a5ecb50d871aa
2014-02-20 16:50:26 -05:00
Asumu Takikawa
d78535d187 Add subtyping tests for classes/objects
original commit: 8331d8c8a2e994a2c961e18977d9563a3f92ba8d
2014-02-20 16:50:26 -05:00
Asumu Takikawa
3222baafbd Simplify typechecking for some field initializers
This seems to speed up type-checking for some
initializers. The caveat is that it's slightly less
paranoid about type-checking the expansion.

original commit: 03c74a16ff0c9f8707361e0818b37c99ae5d00d9
2014-02-20 16:50:26 -05:00
Asumu Takikawa
546a52843d Simplify type expression
original commit: 80d21e106c8aeed582de2bedfd4fbd586a3a16c4
2014-02-20 16:50:26 -05:00
Asumu Takikawa
6d6bf8f553 Avoid type-checking type annotation clauses
original commit: e52256b7f08e5e4bb5846fd5bbfc2032b46ea45e
2014-02-20 16:50:26 -05:00
Asumu Takikawa
566b4d3dfb Make subtyping checks on objects faster
original commit: c8e5423e557cf5976bdb0050b72979b9fb9c76a4
2014-02-20 16:50:26 -05:00
Asumu Takikawa
97c6350e87 Fix augment type printing
original commit: e80c4d72fb3ef7ee86915d17d5c6d5e1837bc800
2014-02-20 16:50:26 -05:00
Asumu Takikawa
c07f80cc07 Allow polymorphic method types
original commit: 7d7f23589f31eab49cec51e63c40d7065b0e2596
2014-02-20 16:50:26 -05:00
Asumu Takikawa
d298da507f Add internal timing support for classes
original commit: 45b8e17687d925fa282220d03c73ed09a47ab2c7
2014-02-20 16:50:26 -05:00
Asumu Takikawa
65dc0c6374 Adjust local expansion to account for local macros
original commit: 7cc9b0ef12dd4eacf36c2bf619e1687da0ca689f
2014-02-20 16:50:26 -05:00
Asumu Takikawa
5b6fcb01dc 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.

original commit: 54bc1732da258f4d1f979fde24c793790b8c50ba
2014-02-20 16:50:26 -05:00
Asumu Takikawa
02f61dbd05 Add support for in-line class polymorphism
original commit: 37c1730bb3db2007d6ff25455103f7f0ea95b69f
2014-02-20 16:50:26 -05:00
Asumu Takikawa
dd208670d5 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.

original commit: 3c044e23fda47897b77676f5c9d8c9434754581e
2014-02-20 16:50:26 -05:00
Asumu Takikawa
3022f91b48 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.

original commit: 8ca8eb164205df1850ce677d3e37053712565ed8
2014-02-20 16:50:26 -05:00
Asumu Takikawa
bd47f1e634 Refactor class type-checker
original commit: f8212063b798f866fc91862942b54baaae7194eb
2014-02-20 16:50:26 -05:00
Asumu Takikawa
aa3f6c7b9b Use lists as sets for type-checking classes
original commit: dbf9459e99465e73bd9adaa6a907e5516107b284
2014-02-20 16:50:26 -05:00
Asumu Takikawa
8b56ec986e Improve error messages for superclass checks
Also add a test for the inherit-field case for this

original commit: ed94d35105d43b087eab1814f939e86c593364f9
2014-02-20 16:50:25 -05:00
Asumu Takikawa
b7f41e65d7 Add support for inherit-field
original commit: c16ace02fa15ab1a1ca7e17fe66c666d44ccf23a
2014-02-20 16:50:25 -05:00
Asumu Takikawa
211f4f4db5 Fix a private/augment method issue
original commit: e25b24986fc2c141a0abd8a4f6f4245f94d1f379
2014-02-20 16:50:25 -05:00
Asumu Takikawa
8e7bfb9ad8 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

original commit: 008e18a6b44e2a363c706bb1994ccee6c56dec98
2014-02-20 16:50:25 -05:00
Asumu Takikawa
707f6ed62d Improve error messages
original commit: 37c313e9b3f4c1cebc726711616b4ec4fcef747d
2014-02-20 16:50:25 -05:00
Asumu Takikawa
ea7d2b92cd 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.

original commit: 27a7322033fecaf99e043bdfd06c50efe0a7898c
2014-02-20 16:50:25 -05:00
Asumu Takikawa
ceda8ae1a7 Error on duplicate type annotations
original commit: 98b49deb76dc96af23efb3b0742f1a8bed3e6d36
2014-02-20 16:50:25 -05:00
Asumu Takikawa
36d434b42b Allow type annotations in class clauses directly
original commit: 0ef3f09768f1d44887abf28aca1f68d05916e9d3
2014-02-20 16:50:25 -05:00
Asumu Takikawa
81a7b3b55e Use class instead of class: for typed classes
original commit: a6daafd70a58a988f3c7c6795eb56ce84d541882
2014-02-20 16:50:25 -05:00
Asumu Takikawa
4947ef6e53 Add support for basic polymorphic classes
original commit: 91729c060cd431cb3b438aa6f0d3572ed456ab22
2014-02-20 16:50:25 -05:00
Asumu Takikawa
f59585bb5a Improve handling of expected type
original commit: 71d590604f33ecf9e9f2fb31307b4b01f79fc048
2014-02-20 16:50:25 -05:00
Asumu Takikawa
6bd6b9e1e2 Add expected error messages to class tests
original commit: e3efb90a59e08f30636fce70ffaeae28c59dfd2c
2014-02-20 16:50:25 -05:00
Asumu Takikawa
fcc096d51d Fix contracts on TR functions
original commit: 86093f88beb97120f1fe41a38e8c4741ff1043bc
2014-02-20 16:50:25 -05:00
Asumu Takikawa
0dd6b87991 Improve several type error messages
In particular, improve the syntax reported when the
method arity is wrong.

original commit: 6cdc5fb720cb69a9c6c541632e0e97bd571f1b23
2014-02-20 16:50:25 -05:00
Asumu Takikawa
1722644560 Enforce method types as function types in parsing
original commit: 0d498e18e7c6284a87797e7491906523ca641fe1
2014-02-20 16:50:25 -05:00
Asumu Takikawa
707de1ef68 Add a unit test for ill-typed private methods
original commit: 7ba8dd57cbffe66bb76cab053fed6e80cc193693
2014-02-20 16:50:25 -05:00
Asumu Takikawa
fd9c06e10f 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.

original commit: eb95264e3f3d04e0427f01f26e19447ad9fe4b12
2014-02-20 16:50:25 -05:00
Asumu Takikawa
e0da126e85 Make type parsing error more informative
original commit: 1dede055492351e2d1d96b95dd5267741d359a03
2014-02-20 16:50:24 -05:00
Asumu Takikawa
3d741fced7 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.

original commit: 92e34ebab960496f7b2faf6502ca895b2d2e00ae
2014-02-20 16:50:24 -05:00
Asumu Takikawa
3ce105ffde 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

original commit: 939c3bb4c8aeafe7673e70db9398414ab2e29260
2014-02-20 16:50:24 -05:00
Asumu Takikawa
3bd5ae4ac6 Change #:extends to #:implements
original commit: 884c898bfa04c2334317c5a4ee96e7354804865d
2014-02-20 16:50:24 -05:00