Commit Graph

15 Commits

Author SHA1 Message Date
Asumu Takikawa
b5dc5585be Fix part of GH issue #208
For private `define-values` in classes with multiple variables, don't
eagerly throw type errors in the synthesis step. Instead, wait
until the later checking step when the environment will be correctly
set up.

When the initial synthesis typecheck fails, yield type Any for
the environment. If the typecheck should really fail, this is ok. If
not, then the user can add a type annotation.

A better long-term strategy is to change the handling of environments
so that the type environment gets refined as definitions are checked.
This way all annotations that the user writes are factored into the
initial environment and unannotated variables will have their types
synthesized.
2015-10-20 14:06:32 -04:00
Asumu Takikawa
3149b0a305 Fix send on a receiver with recursive type
Thanks to Matthias for finding the bug
2015-10-19 16:27:11 -04:00
Marc Burns
609d6189e9 Improve typecheck for private field initializers
This patch addresses two issues with `typed/racket/class`:

1. For multiple private fields declared with `define-values`, type
information does not propagate from the values produced by the
initialization expression to the declared fields. This breaks soundness
of private fields: A field can be annotated with a type that does not
contain the field's initial value.

This was resolved by keeping a table of temporary bindings introduced in
the expansion of the initializer along with their types. The field
setter's type is then checked against that of the corresponding
temporary.

2. The class body typechecker assumes that the `expr` of
a `define-values` clause will expand to a bare `(values vs ...)`.

This was resolved by generalizing the template for matching an expanded
`define-values` initializer and extracting the type information from the
`expr` instead of each element in `(vs ...)`.
2015-05-12 18:42:05 -04:00
Andrew Kent
cbbf5536d8 no objects for mutated private class fields
tidy up ->acc
2015-04-08 17:53:00 -04:00
Asumu Takikawa
78fc0f19e7 Improve types for private field accessors
Enables better occurrence typing for private fields
2015-02-23 15:38:28 -05:00
Asumu Takikawa
888893d81b Work around type alias printing limitations
Type aliases in internal definition contexts can affect
type printing outside of the context, which can cause
interference in unit tests.

This only seems to happen when running with the TR test
driver.
2015-02-12 16:31:18 -05:00
Asumu Takikawa
62c86d5ddd Added occurrence typing for private fields.
This also tracks mutation of private fields to ensure that only
non-mutated field types are allowed to be refined.
2015-02-12 16:31:18 -05:00
Asumu Takikawa
6c09d52b2e Generalize method handling in TR
Previously, TR only recognized a subset of the syntax that
the class macro accepts for method definitions (and errored
unhelpfully on other cases). Though that subset was sufficient
for most methods, macros will sometimes produce unusual forms.
2015-02-08 18:29:37 -05:00
Asumu Takikawa
066e4356b4 Support type alias definitions in class bodies 2015-01-22 14:22:11 -05:00
Asumu Takikawa
5c090ba686 Fix new error messages for class/object types
Closes PR 14942
2015-01-21 13:55:19 -05:00
Asumu Takikawa
4ab7ba2578 Improve check-below errors for classes/objects
Also fix a type-checker bug that the tests for the
error messages uncovered.
2015-01-20 19:58:25 -05:00
Asumu Takikawa
ded837ce10 Fix tc/send to accept keyword argument methods
Closes PR 14910
2015-01-12 18:36:35 -05:00
Asumu Takikawa
dbaebdd305 Propagate expected types better for private fields
Closes PR 14911
2015-01-04 19:39:14 -05:00
Asumu Takikawa
791a16e54f Fix method definitions with lambda/case-lambda
Closes PR 14904
2015-01-01 01:59:37 -05:00
Vincent St-Amour
134f793ccc Reduce directory nesting for tests. 2014-12-16 10:07:25 -05:00