Commit Graph

4604 Commits

Author SHA1 Message Date
Georges Dupéron
a41dee5b93 Fixes 539: Type of literal regexp is not the literal regexp itself 2017-12-06 23:06:32 +01:00
Ben Greenman
504f11cc94 tc-app: add missing 'function' annotations
Update the type-table with annotations for some identifiers
 that are handled specially by `tc-app`.

Add type table tests to `unit-tests/typecheck-tests.rkt`
2017-12-06 01:35:59 -05:00
Ben Greenman
fd5d5e9319 add types for new numeric primitives
- positive-integer?
- negative-integer?
- nonpositive-integer?
- nonnegative-integer?
- natural?
2017-12-06 00:49:48 -05:00
Andrew Kent
d32218ad15
have inst use Any as default type for omitted args
In addition to potentially being convenient, this helps us not
break backwards compatibility when APIs add features that require
additional type variables to properly type.
2017-11-10 17:38:57 -05:00
Andrew Kent
4a869d97d1
update check-duplicates with #:default kw arg 2017-11-10 12:02:35 -05:00
Ben Greenman
9fe2252eef add regression test for (Sequenceof T)
Test to make sure `(Sequenceof (Boxof T))` wraps sequence elements in a contract
2017-11-08 21:04:30 -05:00
Sam Tobin-Hochstadt
f35a6fd5cb Avoid wrapping 5 when contracted as (Sequenceof Integer)
Closes racket/math#13
2017-11-08 09:49:22 -05:00
Ben Greenman
966845304e static-contracts: improve optimizer's test for flat scs
* Add `instantiate/optimize` to the static contracts API
  (new function in `instantiate.rkt`)
* Add optional kwd arg `#:recursive-kinds` to sc optimizer
* SC optimizer uses recursive kinds to tell if a `name/sc` or `recursive-sc`
  will generate a flat contract
* `instantiate/optimize`
  - solves for a recursive kinds table
  - calls `optimize` with the table
  - calls `instantiate` with the same table
2017-11-07 00:35:28 -05:00
Andrew Kent
cd181f9d90
check-below use props if with-refinements on 2017-11-05 21:10:58 -05:00
Andrew Kent
f372bdda3e
more general linear exp stx for props 2017-11-05 19:20:03 -05:00
Andrew Kent
1a042f8520
fix parsing of refinements and type aliases 2017-11-05 15:32:21 -05:00
Andrew Kent
160e926da8
add make-vector refinement types 2017-11-02 17:07:41 -04:00
Andrew Kent
8b2c31cab8
fix safe-vector test file 2017-11-02 13:33:19 -04:00
Andrew Kent
0f733e29fe add missing check for false in tc-error 2017-10-25 12:44:45 -04:00
Sam Tobin-Hochstadt
7349793f5a Typed Racket HISTORY update. 2017-10-23 17:08:28 -04:00
Ben Greenman
26f65f13f7 improve hash/c error message when non-flat-key applied to non-equal?-hash 2017-10-06 16:59:08 -04:00
Ben Greenman
cfa9918ac5 change out-of-date test 2017-10-06 16:03:46 -04:00
Ben Greenman
a58fc276c9 cleanup names, add tests 2017-10-06 16:00:50 -04:00
Ben Greenman
6cffbfa6d8 checkpoint: example fix for msgpack failure 2017-10-06 15:18:47 -04:00
Andrew Kent
2ef852ae91 fix case lambda (#620)
fix case-lambda checking when no expected type

Not we will check each clause against the other applicable
arrows that are derived during type synthesis for soundness
sake. At a future date, if we instead compute a more 
complete "intersection" of these arrows and then
check against that intersection, that would admit more
correct programs.
2017-10-03 14:20:30 -04:00
Andrew Kent
ffcf5afe92 fix optional and rest arg reasoning (#618) 2017-10-02 23:44:23 -04:00
Sam Tobin-Hochstadt
f1af04fcfa Handle subtyping with all-optional kw args better.
Problem reported by @schackbrian2012. Closes #608.
2017-10-02 12:37:37 -04:00
Ben Greenman
d3efa46003 static-contract: temporary fix for 'Syntax' contract (#617)
Add a case to the static contract optimizer so that contracts
 generated from the `Syntax` type disappear in trusted positions.

This restores the "old" behavior for the `Syntax` type --- the behavior
 before fixing the 'or/c' unsoundness in issue 598.

<https://github.com/racket/typed-racket/issues/598>

Note: this fix is temporary, until the definition of `Syntax` can
 be in terms of _immutable_ vectors & boxes.
2017-10-01 21:02:12 -04:00
Alex Knauth
4465273da2 Should TR optimizer docs recommend real->double-flonum (#498)
instead of exact->inexact?

Since its usage in the guide is to create a value of type Float on which TR can apply optimizations, real->double-flonum seems like the the better choice. The type of exact->inexact can sometimes produce single flonums or complex numbers, but real->double-flonum always returns a Float.

For converting exact complex numbers into inexact complex numbers I don't see another option; I'm not sure what to do there.
2017-10-01 17:36:23 -04:00
WarGrey Gyoudmon Ju
d106797238 Subwindow<%> has a method reparent (#507) 2017-10-01 16:06:08 -04:00
Andrew Kent
5e507d3b4a clean up failed function app printing (#611) 2017-10-01 15:30:31 -04:00
Alex Knauth
ee7207d67d Fix cast under multiple cases of case-> (#589)
* fix cast under multiple cases of case->

* add test

* Comments explaining cast-table's lists of types and what they mean
2017-09-30 19:19:18 -04:00
Ben Greenman
9df037b0f6 static-contracts: less or/sc optimization
Prevent the static contract optimizer from changing constructors under `or/sc`.

i.e., for static contracts of the form `(or/sc other-scs ...)`,
 the optimizer cannot optimize any of the `other-scs ...` to `any/sc`
 but it can optimize sub-contracts of the `other-scs ...`

Example:
  `(or/sc set?/sc (box/sc set?/sc))` in a trusted position now optimizes to itself,
  instead of `any/sc`

Optimization can resume under a sub-contract that represents a "heavy" type constructor.
(I mean, `U` is a type constructor but it's not "heavy" like that.)
2017-09-28 23:48:22 -04:00
Andrew Kent
ff1446f85e never print Void as a val 2017-09-25 21:12:37 -04:00
Andrew Kent
8aa05bebff add dependent function types (#584)
Adds the following:
+ dependent function Types
+ some existential object support when applying
  dependent functions
+ simplify linear arith support
+ add unsafe-require/typed/provide
2017-09-25 12:52:33 -04:00
Ben Greenman
137c138b2e static-contracts: fix list-length/sc
- Change `list-length/sc` to be a contract for lists
- Add tests to check sc-generated contracts against values
2017-09-19 00:13:00 -04:00
Ben Greenman
47b0de7a52 doc: move source-syntax docs to typed-racket-doc package 2017-09-06 11:15:10 -04:00
Jack Firth
453825d1fe Remove typed rackunit code and depend on other package (#596)
* Remove typed rackunit code and depend on other package
2017-09-06 11:29:00 +01:00
Ben Greenman
0b191039b5 gitignore: vim swapfiles 2017-09-05 16:53:31 -04:00
Ben Greenman
5d1ff0327f doc: scribblings for 'syntax/source-syntax' 2017-09-05 16:50:45 -04:00
Sam Tobin-Hochstadt
78a04f47ca add TR HISTORY 2017-07-27 20:39:00 -04:00
Sam Tobin-Hochstadt
75208f4328 Improve loop inference heuristics.
Closes #579
2017-07-16 19:54:14 -04:00
Andrew Kent
3a7c0b5123 list -> cons typo 2017-07-15 14:01:57 +01:00
Jack Firth
6369753c28 Fix typed/rackunit contract exception when using run-tests (#583)
* Add a test that suites and run-tests work in typed/rackunit

* Fix Seed type

The "seed" parameter of fold-test-results is passed to each test suite but, near as I can tell, never actually interacted with by the suite.
2017-07-14 08:58:11 -04:00
Ben Greenman
afa0530b3a backwards-compatibility: make HashTableTop generate a flat contract
Changing `HashTableTop` from a singleton to the union:

```
  (U (Immutable-HashTable Any Any) MutableHashTable WeakHashTable)
```

is a backwards compatibility issue because the type `Any` requires a chaperone,
therefore `HashTableTop` requires a chaperone.

This commit adds a case to make sure `HashTableTop` generates a flat contract.
2017-07-13 15:13:59 -04:00
Ben Greenman
4bf6961551 fix type of integer-bytes->integer
and the corresponding tests
2017-07-12 16:41:51 -04:00
Vincent St-Amour
55114e298e Tests for #577.
Closes #576
2017-07-10 16:24:57 -05:00
Spencer Florence
c75779b1a1 attempt to fix float-complex 2017-07-10 15:56:45 -05:00
Andrew Kent
e188551b19 fix binder lvl typo 2017-07-02 09:24:50 +01:00
Jack Firth
e19b53fd9f Remove typed/rackunit references to check-around (#568)
* Remove typed/rackunit references to check-around

This is an internal implementation detail of rackunit. The `current-check-around` parameter is set to `check-around` by default, so there's no need to explicitly set it in test-begin.

* Bump version

* Remove check-around from type environment
2017-07-01 23:44:05 +01:00
Andrew Kent
000af1f28c add generalize clauses for new hash types 2017-07-01 22:44:48 +01:00
Andrew Kent
f2bf1062bc erase object when inst is present (#572) 2017-07-01 18:11:18 +01:00
Andrew Kent
9a6c1ba63d fix trivial bug in subtract (#571) 2017-07-01 17:46:36 +01:00
Andrew Kent
fa828df919 simplify arrows a little, less list allocation (#566) 2017-07-01 16:56:22 +01:00
Andrew Kent
c97c90d2ee break up travis build 2017-07-01 12:15:28 +01:00