Commit Graph

178 Commits

Author SHA1 Message Date
Sam Tobin-Hochstadt
fca96dcdc1 Quote typecheck-fail-internal properly.
Caught by existing unit tests.
2015-07-20 15:34:49 -04:00
Matthew Flatt
1842aaa2bd fixes for some tests
The `identifier-binding` function is now senstive to the "macro
introduction" scope that's on an indentifier provided to a currently
expanding macro. Unit tests for TR need to use
`syntax-local-intorduce` to remove it, in the same way that `tc-setup`
already does.

Also, recognize a class expansion when it's wrapped with
`#%expression`, since `class` now expands that way sometimes.
2015-07-16 08:40:35 -06:00
Matthew Flatt
8c006da763 remove syntax-local-make-delta-introducer 2015-07-16 08:40:34 -06:00
Matthew Flatt
2d095c4112 adapt to letrec-syntaxes+values removal and quote-syntax extension
The `quote-syntax` form now suports a `#:local` option, which is
used for type annotations to preserve binding context.

Since `letrec-syntaxes+values` is now removed by `local-expand`,
some patterns must be adjusted, including the pattern used
for type annotations.
2015-07-16 08:40:34 -06:00
Matthew Flatt
2f00de99d0 declare empty namespace for submodules
Using the enclosing module's context for the `#f` part of the
`(module* _ #f ....)` would generally enable a compact encoding of
bindings for the purposes of `module->namespace`. Disabling
`module->namespace` for the generated submodules seems more reliable,
and it seems unlikely that anyone will miss the extra debugging
capability (which is all that is lost for these submodules whose
content is, I think, unspecified).
2015-07-16 08:40:34 -06:00
AlexKnauth
aec5fad4be make append preserve non-emptyness of first argument
see https://github.com/racket/scribble/pull/8#discussion_r33423152
2015-06-28 12:07:42 -04:00
Sam Tobin-Hochstadt
9a2b74dc33 Generate trivial constraints for missing type variables.
If the type variable isn't mentioned anywhere, then just
pick `Any` as its substitution.

Fixes #152.
2015-06-23 16:08:23 -04:00
Vincent St-Amour
6bef6e6ca8 Make type of abs and magnitude more precise.
Fixes a failing test.
2015-06-16 12:00:07 -05:00
Eric Dobson
0498f548c1 Fix the type of abs on negative zeros. 2015-06-16 10:43:01 -05:00
Asumu Takikawa
0892e23892 Resolve expected type in tc-lambda-unit
Closes #144
2015-06-10 12:23:39 -04:00
Asumu Takikawa
bc3443b393 Change Module-Path type to accommodate submodules
Closes #84
2015-06-10 12:21:51 -04:00
Sam Tobin-Hochstadt
91e3a1b5f0 Make sure that user-specified clauses come before default clauses in type-case.
Avoids nasty hash ordering bugs.
2015-06-02 17:32:33 -04:00
Asumu Takikawa
b63514a2c3 Allow more flexible keywords in ->* types
Keyword argument types in ->* are now allowed intermixed with
positional arguments instead of at the end.

Closes #145
2015-06-02 01:05:05 -04:00
Eric Dobson
8014db0f7d Make infer unfold Mu before spliting on Unions. 2015-05-19 20:44:15 -07:00
Eric Dobson
d4eaa47b27 Make subtype use hash of hashs.
This has a 1% improvement on new-metrics.rkt by my measurements.
2015-05-19 20:37:41 -07:00
AlexKnauth
e075523e5e change type of partition 2015-05-19 16:29:49 -04:00
Alexis King
a096857a88 Disable the #{} reader macro if a dispatch macro already exists on #\{ 2015-05-14 14:35:30 -07:00
AlexKnauth
b11e48fa93 don't raise error for require/typed in module-begin context 2015-05-14 12:13:14 -04:00
Alex Knauth
c6b1f8fdc0 syntax error for require/typed in untyped code 2015-05-14 12:13:14 -04:00
Asumu Takikawa
92d1dd1c5e Add sealing contracts for row polymorphic types
This enables contract generation in the negative
direction (untyped->typed) for row polymorphic types
(basically mixin types).

Depends on `class-seal` and `class-unseal` in
the racket/class library.
2015-05-13 20:52:32 -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
Asumu Takikawa
5751a2e1cf Refactor get-field checking to avoid bad names 2015-05-12 15:08:53 -04:00
Eric Dobson
90061c2b96 Add filters for trivial cases in arithemetic procedures. 2015-05-02 08:26:50 -07:00
Eric Dobson
22342d6a35 Simplify flsqrt type. 2015-05-02 08:26:50 -07:00
Eric Dobson
fc4e216fc2 Simplify flexp type. 2015-05-02 08:26:50 -07:00
Eric Dobson
142b52918c Fix types for flmin and flmax.
flmin and flmax only take two arguments.
2015-05-02 08:26:50 -07:00
Eric Dobson
848b69b73d Simplify flonum comparison types. 2015-05-02 08:26:50 -07:00
Eric Dobson
d288b14244 Expand type of fl/. 2015-05-02 08:26:50 -07:00
Eric Dobson
c50b6291e2 Cleanup fl* type. 2015-05-02 08:26:50 -07:00
Eric Dobson
811cd211e9 Tighten fl+ and fl- types. 2015-05-02 08:26:49 -07:00
Eric Dobson
c3c134780e Cleanup fx shifts. 2015-05-02 08:26:49 -07:00
Eric Dobson
3c978d82cb Tighten fxior and fxxor. 2015-05-02 08:26:49 -07:00
Eric Dobson
424658f6ab Tighten fxmin and fxmax.
Replace Zero case with all NonNegative or NonPositive values.
2015-05-02 08:26:49 -07:00
Eric Dobson
93b538b694 Cleanup types of fixnum comparisons.
Unify Zero and One cases, and remove extraneous ones.
2015-05-02 08:26:49 -07:00
Eric Dobson
114b9376f1 Tighten type of fxabs. 2015-05-02 08:26:49 -07:00
Eric Dobson
ad09e941a8 Tighten type of fxquotient 2015-05-02 08:26:49 -07:00
Eric Dobson
c923663e55 Tighten type of fx*
Make multiplication by Zero return Zero and by One return the other arg.
2015-05-02 08:26:49 -07:00
Eric Dobson
6bc24fdf83 Fixup type of fx-
fx- is not commutative.
Output is always a fixnum.
2015-05-02 08:26:48 -07:00
Eric Dobson
b6a53b8916 Cleanup types of fx+
Fix case for two Bytes which should be Index not PosIndex.
2015-05-02 08:26:48 -07:00
Eric Dobson
86d5845bc4 Replace exclude-zero with commutative-equality/strict-filter.
Make it more obvious what the generated type is.
Also removes NaN from the specific type for flonums because that was
incorrect.
2015-05-02 08:26:48 -07:00
Eric Dobson
69e613c831 Simplify types for nan? and infinite? 2015-05-02 08:26:48 -07:00
Eric Dobson
e91cdad6b0 Tighten types on sgn. 2015-05-02 08:26:48 -07:00
Eric Dobson
ddd503a203 Fix type on integer-sqrt/remainder.
It doesn't return exact integers when given inexact input.
2015-05-02 08:26:48 -07:00
Eric Dobson
eeef1a7c55 Simplify types of integer-sqrt. 2015-05-02 08:26:40 -07:00
Eric Dobson
70fdc3dd13 Make flonum and ext-flonum types use the same definitions.
This avoids problems where one could be changed to fix a bug and the
other would be missed.
2015-04-28 20:27:44 -07:00
Vincent St-Amour
257d4ec9a7 Fix use of values in type of integer-sqrt/remainder.
Closes PR 15034.
2015-04-28 17:49:53 -04:00
Asumu Takikawa
a80f55946d Adjust error messages for : annotation form
Print better error messages for expression like
(: 2 Zero). Also fix and improve error messages for
multiple/missing types.

Closes PR 15044
2015-04-21 16:07:13 -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
7bf4314af4 Simplify Name type representation
Avoids contract errors by using a simpler representation
and sticking with it throughout.
2015-04-08 11:23:48 -04:00
Asumu Takikawa
d22bf8cc11 Fix type-name-env contracts and uses 2015-04-08 11:23:48 -04:00