Commit Graph

3217 Commits

Author SHA1 Message Date
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
Asumu Takikawa
1be1fb5e18 Add parsing for (Object ...) types into Instances
original commit: c47531569a204c789d00c413abc70494738b137a
2014-02-20 16:50:24 -05:00
Asumu Takikawa
cd6f49d645 Improve object type printing
Use the `Object` constructor style instead of `Instance`
in cases where it makes sense.

original commit: 32f39ddff49c09db5533aab8baba1a202f2332f7
2014-02-20 16:50:24 -05:00
Asumu Takikawa
3b46f8aec3 Add syntactic sugar for recursive class types
original commit: 081cc4777ae59044af3631d5e58d56fec25bbda6
2014-02-20 16:50:24 -05:00
Asumu Takikawa
49eb5a40a0 Attempt to support recursive types in classes better
original commit: a1efc2c276e7a37d3ae9faff6414e5a54e9bdcbf
2014-02-20 16:50:24 -05:00
Asumu Takikawa
dbfba09d05 Remove debug displays
original commit: 16ca57500b3446866668fc80f7287f9cb4939f27
2014-02-20 16:50:24 -05:00
Asumu Takikawa
d78377c5af Attempt to allow recursive types in objects/classes
Contract generation is not implemented correctly yet
since the static contract portion needs adjustment.

original commit: 19b1ca17c63463a40542366e040cb981066228bf
2014-02-20 16:50:24 -05:00
Asumu Takikawa
00a4494ba7 Allow duplicate type names if they have the same type
original commit: cc61f0639ec433061d491ba7bf1023cccaf2020f
2014-02-20 16:50:24 -05:00
Asumu Takikawa
97cd75165d Add "multiple inheritance" for class types
original commit: f84cf996c36a78a43a13827411a7d498c6cabf05
2014-02-20 16:50:24 -05:00
Asumu Takikawa
9ca8361ced Don't add super-type inits into type with #:extends
original commit: 4543204e859cddfa6abacd52ff725ceb6dca6ee6
2014-02-20 16:50:24 -05:00
Asumu Takikawa
defa74d44a Support private fields
original commit: bbd5d97a230bf8bab1d4bf3e5d88a606b86e637e
2014-02-20 16:50:23 -05:00
Asumu Takikawa
a2250fad43 Add super calls
(also removed bogus super-new init test)

original commit: 45599812128b2d5b1f52db91b792ffeec5c8ad40
2014-02-20 16:50:23 -05:00
Asumu Takikawa
07206b7f17 Don't make mandatory super inits mandatory for super-new
original commit: ba70851ba0dd7f812dd5f10dee36b2008e74f103
2014-02-20 16:50:23 -05:00
Asumu Takikawa
d7f6d81607 Fix type-checking for fields with this
original commit: f82a49be7dbf6e0abb5598179e85a5a06cb0cf2b
2014-02-20 16:50:23 -05:00
Asumu Takikawa
5dd26e30dc Fix subtyping for fields
original commit: 6b5875a1f1c4250a996e461609682d22ba428194
2014-02-20 16:50:23 -05:00
Asumu Takikawa
9d5a2d5f36 Make keyword methods type-check
Note: send does not work with keyword methods yet

original commit: 5da60f70673cd997b746b2fc437f9f8a055216dd
2014-02-20 16:50:23 -05:00
Asumu Takikawa
88af42a16a Add support for inherited methods
original commit: 4e5d0846baec22d8b23bc34a86c61881d8b36ca0
2014-02-20 16:50:23 -05:00
Asumu Takikawa
d04f0b6727 Attempt better error message for bad method type case
original commit: 30e3c498867dcd6b188157321b4ae7c5491329f2
2014-02-20 16:50:23 -05:00
Asumu Takikawa
d113733ab8 Better support for class top-level behavior
original commit: 0d5a775a62eb6dae2dba92012f49f9467685a4b1
2014-02-20 16:50:23 -05:00
Asumu Takikawa
ddf31e527e Allow top-level expressions to refer to inits
original commit: b9a175eed277138f9f4216b2f4694a3e27b7d7bb
2014-02-20 16:50:23 -05:00
Asumu Takikawa
290abc0333 Cleanup FIXME comments
original commit: 384e1392bd985c7f376f54df9a24374a40532e35
2014-02-20 16:50:23 -05:00
Asumu Takikawa
9e17db7f38 Improve super-new handling.
Now `super-new` calls are type-checked with the right
context so that init arguments can be passed as arguments.

In addition, the `super-new` checking was factored out into
three functions.

original commit: 6f86c66199bde3989a0b603b7386baa58167247d
2014-02-20 16:50:23 -05:00
Asumu Takikawa
25b1b3f648 Fix optional argument check that was broken
original commit: 44f9b87f02480b3e805b9891f3e31d49c7a3f410
2014-02-20 16:50:23 -05:00