Commit Graph

120 Commits

Author SHA1 Message Date
Andrew Kent
f9c5a534d0 filter -> prop
This pull request is largely a renaming effort to clean up the TR codebase. There are two primary things I wanted to change:

1. Replace all occurrences of "filter" with "prop" or "proposition"
   - The word "filter" is a meaningless opaque term at this point in the Typed Racket implementation. If anything, it just adds confusion to why things are the way the are. We should use "proposition" instead, since that's what they actually are.

2. Avoid using "Top" and "Bottom" in both the type and proposition realm.
   - Currently the top type is called Univ and the bottom type is called bottom, while the top proposition is called Top and the bottom proposition is called Bot. This is just unnecessarily confusing, doesn't really line up w/ the user-space names, and doesn't line up with the names we use in TR formalisms. Worse, all of the top types of primitive types---e.g. the type of all structs, StructTop--- use Top, so it is really easy to get confused about what name to use for these sorts of things.

With these issues in mind, I made the following changes to names:

Top -> TrueProp
Bot -> FalseProp
TypeFilter -> TypeProp
NotTypeFilter -> NotTypeProp
AndFilter -> AndProp
OrFilter -> OrProp
-filter t o -> -is-type o t
-not-filter t o -> -not-type o t
FilterSet -> PropSet
NoFilter -> #f
NoObject -> #f
-FS -> -PS
-top -> -tt
-bot -> -ff
implied-atomic? q p -> implies-atomic? p q
filter-rec-id -> prop-rec-id
-no-filter -> -no-propset
-top-filter -> -tt-propset
-bot-filter -> -ff-propset
-true-filter -> -true-propset
-false-filter -> -false-propset
PredicateFilter: -> PredicateProp:
add-unconditional-filter-all-args add-unconditional-prop-all-args
2016-04-25 18:36:12 -04:00
Alex Knauth
bacc1b3411 Fix type of syntax->list (#348)
* Fix type of syntax->list

to return `(U False (Listof (Syntaxof Any)))` if it can't prove that the input is a syntax-list.

Fixes https://github.com/racket/typed-racket/issues/347
This makes the type `syntax->list` consistent with the type `stx->list` already has.

* Add tests for syntax->list
2016-04-16 20:18:59 -04:00
ben
f820fac6a0 regression tests
For github issues 111 113 114 115
2016-04-11 17:27:19 -04:00
Asumu Takikawa
acef58a5d0 Add an extra test for new random case 2016-04-07 17:00:13 -04:00
Asumu Takikawa
9ec358b665 Update type-table after tc-funapp processing
This makes the tooltip show the more refined function
type after application typechecking. For example, case->
types will be narrowed to the particular case that fits.

Polymorphic function types will be instantiated at the
appropriate type.

Fixes issue #325
2016-03-28 17:53:34 -04:00
Asumu Takikawa
812f1a8c79 Add types for box-cas!, unsafe-box*-cas! 2016-03-23 16:02:22 -04:00
Asumu Takikawa
d23e05f2c3 Escape "~" in tc-error/fields arguments
Fixes issue #314
2016-03-02 04:43:34 -05:00
Asumu Takikawa
72927e2248 Add the rest of Racket's exn hierarchy 2016-02-21 12:20:40 -05:00
Asumu Takikawa
a90f6c46eb Add exn:break:hang-up and exn:break:terminate 2016-02-21 02:48:45 -05:00
Stephen Chang
c19fac7fd5 add ids from in-hash- expansion to special-env
- fixes test failures due to 048c4b4a73
- add in-hash- tests
2016-02-05 18:26:03 -05:00
Sam Tobin-Hochstadt
838431c176 Add the simple-result-> combinator to Typed Racket.
This is used for functions with a single argument imported with
`require/typed`, and avoids unneccessary checks. This produces a
3x speedup on the following benchmark:

  #lang racket/base
  (module m racket/base
    (provide f)
    (define (f x) x))
  (module n typed/racket/base
    (require/typed
     (submod ".." m)
     [f (-> Integer Integer)])
    (time
     (for ([x (in-range 1000000)])
       (f 1) (f 2) (f 3) (f 4))))
  (require 'n)

on top of the previous improvment from using `unsafe-procedure-chaperone`
and `procedure-result-arity`.
2016-01-16 22:27:18 -05:00
Sam Tobin-Hochstadt
519dfb6fdc Handle Sequenceof in the type parser to support multiple values. 2015-12-17 19:42:29 -05:00
Vincent St-Amour
70afdf6f70 Relax type of expt.
Made possible by the fix to its dynamic behavior.

Should be fully backwards compatible.
2015-12-02 15:44:23 -06:00
Vincent St-Amour
1d69569382 Fix tests. 2015-11-30 07:56:08 -06:00
Vincent St-Amour
6a8c366210 Fix type of expt to reflect fix to dynamic behavior. 2015-11-25 17:33:00 -06:00
Sam Tobin-Hochstadt
f9825cb250 Add test for top-level mutated var fix. 2015-11-18 14:31:48 -05:00
Vincent St-Amour
1e32397658 Refine type for expt.
Fixes rsound.
2015-11-13 10:14:39 -06:00
Sam Tobin-Hochstadt
d9e3c2ac6a Repair da574a4 again. 2015-11-10 08:59:18 -05:00
ben
5d4477d08d safe & efficient (-> Any Boolean) contract
New strategy for compiling the (-> Any Boolean) type to a contract.
When possible, uses `struct-predicate-procedure?` instead of
 wrapping in `(-> any-wrap/c boolean?)`.
Makes exceptions for untyped chaperones/impersonators over struct predicates;
 those are always wrapped with `(-> any-wrap/c boolean?)`.

This change also affects (require/typed ... [#:struct ...]), but not #:opaque
2015-11-09 19:04:02 -05:00
Georges Dupéron
67bd07a84a Fixes type of member and assoc, plus some tests for them. See github bug #223: “(member) has wrong type, exploiting the hole causes segfault”. 2015-11-09 19:04:02 -05:00
Vincent St-Amour
6a2c8ca9f7 Fix the fix to flexpt. 2015-11-09 17:16:09 -06:00
Vincent St-Amour
46f2ed95d3 Fix tests for more conservative types. 2015-11-09 17:16:08 -06:00
Vincent St-Amour
9385f6e350 Yet another fix for expt and complexes.
Found using random testing. Found once.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
5ce00a90d2 Fix sign property of n-ary division.
Found using random testing. Found 4 times.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
23de6a654e Fix another NaN case in expt.
Found using random testing. Found 3 times.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
3ef8fe1739 Fix type of expt for bignums that get converted to infinity.
Found using random testing. Found 10 times.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
a0ef6b1d8c Fix type of expt.
Found using random testing. Found 10 times.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
16a18d7648 Fix type of flexpt.
Found using random testing. Found 9 times.
2015-11-09 17:16:08 -06:00
Vincent St-Amour
e4edf7a9ee Remove tests made obsolete by safety improvements. 2015-11-03 18:04:44 -06:00
Vincent St-Amour
89a06cfae6 Fix bitwise-and on negative numbers.
Found using random testing.
2015-11-03 16:02:05 -06:00
Vincent St-Amour
58e97f83ea Fix sign propagation for division.
Found using random testing.
2015-11-03 15:47:32 -06:00
Vincent St-Amour
da97da5ff8 Fix type of expt when mixing floats and float complexes.
Found using random testing.
2015-11-02 19:31:00 -06:00
Vincent St-Amour
e47ffeb0e8 Fix interaction of sign and underflow in fl/.
Found using random testing.
2015-11-02 19:31:00 -06:00
Asumu Takikawa
9b8b525d42 Make unit test less noisy 2015-10-24 04:13:47 -04:00
Asumu Takikawa
2479dffde0 Fix #:opaque require clauses at the top-level 2015-10-21 17:23:24 -04:00
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
Vincent St-Amour
5ed30d7fcf Fix contract build. 2015-09-11 13:12:49 -05:00
Daniel Feltey
2e0cc095c7 Initial support for typed units in typed racket.
Most unit forms are supported, including most of the "infer" forms that
infer imports/exports/linkages from the current context.

Notably, none of the structural linking forms for units are supported, and
`define-unit-binding` is also currently unsupported.
2015-09-10 16:32:11 -05:00
Alexis King
4bf3479776 Add types for writeln and println 2015-09-08 15:58:07 -04:00
Vincent St-Amour
fd3941c062 Remove dependency on unstable/contract. 2015-09-07 21:38:22 -05:00
Brian Lachance
77334808a8 Allow AnyValues as a return type in user code
Closes PR 14217
2015-09-07 13:26:34 -05:00
Asumu Takikawa
f5f84c7625 Fix for*/fold and for*/lists
Only parse and use the type annotations if they are present on
all fold variables. This matches the default for other forms in TR.
Also, this will usually result in a "insufficient type information"
message which is more helpful than if TR chose some default type.

Closes PR 15138
Closes PR 14893
2015-08-25 11:44:24 -04:00
Asumu Takikawa
94ce4b203e Use tc-expr for top-interaction functions instead
This restricts operations like `:print-type` to only
work on expressions. This seems like a reasonable
restriction and simplifies the implementation.
2015-08-14 21:25:54 -04:00
Asumu Takikawa
509f1aa20c Update type for copy-directory/files 2015-08-14 01:02:54 -04:00
Vincent St-Amour
f6779f2cfa unstable/macro-testing -> syntax/macro-testing 2015-08-05 13:13:50 -05:00
Brian Lachance
5e0e8ed713 Fix missing match cases when trying to bind AnyValues typed "results"
tc-toplevel has fixes for define's, tc-let-unit has fixes for let's
2015-07-29 11:44:29 -04:00
Asumu Takikawa
91279f46c7 Add types for recent functions moved from unstable 2015-07-28 14:49:26 -04:00
Asumu Takikawa
2819a62b30 Add types for new syntax operations 2015-07-27 17:15:54 -04:00
Vincent St-Amour
f35b5a9182 check-duplicate -> check-duplicates 2015-07-20 16:17:39 -05:00