Asumu Takikawa
5a3e0a76da
Move typed class unit tests into a separate file
...
Export some helpers from typecheck-tests in a submodule
2014-02-21 13:59:34 -05:00
Asumu Takikawa
c623e662e0
Support set-field! in Typed Racket
2014-02-21 12:32:59 -05:00
Asumu Takikawa
8ce376f503
Adjust type variable syntax for typed classes
...
This makes it consistent with other forms like the
new `lambda` form.
2014-02-21 11:47:08 -05:00
Asumu Takikawa
315034bbe5
Fix type for first argument of dynamic-place
...
Closes PR 14363
2014-02-20 23:17:17 -05:00
Asumu Takikawa
fe811e33aa
Temporarily disable TR class unit test
...
This unit test is broken due to an issue with using
the : form for external names in classes. Since : checks
if the id is bound, it doesn't work if there is an internal
name different from the external name (since only the
internal one is in scope in the class body).
Haven't decided whether to put annotations on internal
identifiers instead or to not run the check for class
member names.
2014-02-20 23:14:23 -05:00
Asumu Takikawa
8c83e1a08d
Expand on docs for TR class init/init-rest args
2014-02-20 18:00:44 -05:00
Asumu Takikawa
f856bce277
Reorganize docs on typed classes
...
Use subsections and put the special forms first
2014-02-20 17:33:45 -05:00
Asumu Takikawa
1c6c0855f7
Revise TR classes & docs based on feedback
2014-02-20 16:50:28 -05:00
Asumu Takikawa
e7e354f69a
Move internal unit tests out into a separate file
2014-02-20 16:50:28 -05:00
Asumu Takikawa
18182d16a6
Add support for positional init arguments for TR
...
This includes support for positional inits and also
init-rest along with make-object and instantiate.
2014-02-20 16:50:27 -05:00
Asumu Takikawa
0b1eec20b5
Use shorthand notation for classes in subtype tests
2014-02-20 16:50:27 -05:00
Asumu Takikawa
cd2ef502b0
Fix integration test for new class type syntax
2014-02-20 16:50:27 -05:00
Asumu Takikawa
39b237043d
Add static contract tests for classes
2014-02-20 16:50:27 -05:00
Asumu Takikawa
dff2fa6de7
Convert parse tests w/ classes to use abbreviations
2014-02-20 16:50:27 -05:00
Asumu Takikawa
92d5e4a8ae
Disallow non-aliases in #:implements
2014-02-20 16:50:27 -05:00
Asumu Takikawa
98a2d248c0
Add abbreviation for classes and use in base-env
2014-02-20 16:50:27 -05:00
Asumu Takikawa
84e780174e
Revise type for is-a?
2014-02-20 16:50:27 -05:00
Asumu Takikawa
e26742e736
Add ClassTop type
...
Still TODO are better error messages when a ClassTop
is encountered for subclassing or instantiation.
2014-02-20 16:50:27 -05:00
Asumu Takikawa
afb1417114
Refactor part of class type system
2014-02-20 16:50:27 -05:00
Asumu Takikawa
0a89b9b718
Add documentation for typed classes
2014-02-20 16:50:27 -05:00
Asumu Takikawa
66c1b10c18
Check for unsupported class clauses and error
2014-02-20 16:50:27 -05:00
Asumu Takikawa
661a371434
Update type->contract for new class representation
2014-02-20 16:50:27 -05:00
Asumu Takikawa
02391fae9d
Rewrite class tests as standard TR typecheck tests
2014-02-20 16:50:27 -05:00
Asumu Takikawa
bd5ec395c2
Allow depth subtyping with #:implements
2014-02-20 16:50:27 -05:00
Asumu Takikawa
00bb219642
Parse-type fix for Instance types
2014-02-20 16:50:27 -05:00
Asumu Takikawa
ee3e83856c
Fix timing in class type-checking
...
(make sure the timing goes away if the flag is off)
2014-02-20 16:50:26 -05:00
Asumu Takikawa
8331d8c8a2
Add subtyping tests for classes/objects
2014-02-20 16:50:26 -05:00
Asumu Takikawa
03c74a16ff
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.
2014-02-20 16:50:26 -05:00
Asumu Takikawa
80d21e106c
Simplify type expression
2014-02-20 16:50:26 -05:00
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