Commit Graph

4583 Commits

Author SHA1 Message Date
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
Ben Greenman
c78a25d9f1 type-contract: use 'Un' to check overlapping hash key types 2017-06-30 01:32:26 -04:00
Jack Firth
b7a55aa9ba Bump version
If `rackunit/private/monad` is removed, this package will break. Bumping the version allows users to update to the version of `typed-racket-more` that doesn't depend on `rackunit/private/monad`.
2017-06-27 07:20:17 -04:00
Jack Firth
70c65a4737 Remove opaque monad type from typed/rackunit
The "monad" struct in RackUnit's internals is never exposed to users and there's no requirement to use it with `fold-test-results`. The "seed" parameter in `fold-test-results` can be any value and is more accurately described by a parametric type. I'm not quite sure what the correct change to make it parametric is, but this change is necessary to remove the dependency on `rackunit/private/monad`. The monad implementation of `rackunit/text-ui` will hopefully go away soon.
2017-06-27 07:20:17 -04:00
Ben Greenman
6c2a7eb512 patch: check duplicates before making an or/c for hash keys
The contract for `(U (I-Hash k1 v1) (M-Hash k2 v2) (W-Hash k3 v3))`
 is now `(hash/c (or/c k1 k2 k3) (or/c v1 v2 v3))`
 ONLY WHEN the key and value types are distinct.
The contract should no longer include duplicate key or value types.
2017-06-27 01:38:18 -04:00
Ben Greenman
fae58e140d add types for Immutable-HashTable, Mutable-HashTable, Weak-HashTable (#559)
The old 'HashTable' type is now the union of the other 3 hash types.

- all operations that used to work on 'HashTable's still work,
  but some now have more specific outputs
- `#hash` literals have type `ImmutableHash`
- `immutable?` and `hash-weak?` are filters
- `Mutable-` and `Weak-` hashes have corresponding `Top` types, `HashTableTop` is now a union
- the contact for `(U (Immutable-Hash K1 V1) (Mutable-Hash K2 V2))` is ONE `hash/c`

Minor notes:

- renamed internal identifiers containing 'Hashtable' to all use 'HashTable'
- add Racket guide/reference 'secref' functions
2017-06-26 18:00:19 -04:00
Andrew Kent
80d8b2ddb7 fix type of 'string-environment-variable-name?' (#558)
it had a nonsensical type before
2017-06-13 10:10:58 -04:00
Ben Greenman
6e3c509a86 require-typed: more informative error when struct field is missing
add a typed-field syntax class (`[id : expr]`) and use it to report errors + simplify other code
2017-06-05 20:21:32 -04:00
Andrew Kent
dda8b1da20 fix resolve usage in overlap, allocate less (#555)
check calls to resolve-once to see if they return #f
(i.e. if a type is not yet defined), and have overlap
only extend its seen list when it is resolving/unfolding
a potentially infinite type
2017-05-22 22:55:33 +01:00
Sam Tobin-Hochstadt
2785e6f950 Handle new potential printing of empty list type. 2017-05-22 16:33:57 -04:00
Vincent St-Amour
3432f80a20 Have Andrew get email for failing tests on DrDr. 2017-05-22 11:20:06 -05:00
Andrew Kent
1eff41d39e fix abstract/instantiate bug and typos (#554) 2017-05-21 10:42:37 +01:00
Andrew Kent
fea71732d2 fix intersection printing err (#551) 2017-05-20 19:22:05 +01:00
Andrew Kent
076b16bdf0 clean up instantiate/abstract for type vars (#546)
this commit involves no functional changes, just tries
to clean up some of the helper functions in type-rep
related to instantiate/abstract for type vars
2017-05-20 15:58:23 +01:00
Andrew Kent
d6166b0ad3 fix intersection bug (#549)
fix intersection bug

intersections with resolvable types would occasionally generate
spurious weird types (e.g. μx.x) when a type name
is not yet fully defined -- this patches that problem by
using resolve-once instead of resolve and checking the result
for #f before proceeding to compute the intersection
2017-05-20 10:39:10 +01:00
Vincent St-Amour
c0af5235d2 Add support for #:ps argument in command-line. 2017-05-18 15:50:18 -05:00
Georges Dupéron
adb806a7e5 Fix types of udp-related functions 2017-05-18 10:40:53 -05:00
Daniel Feltey
764696752d Disarm syntax in typed unit macros
Closes #536
2017-04-27 17:46:23 -05:00
Daniel Feltey
4b35df2c96 Be less rigid about the shape of type annotations in units
Closes #535
2017-04-27 17:24:54 -05:00
Andrew Kent
80d1654dee add more refinement support for inference and literals (#528)
This PR adds more support for refinement reasoning, in particular
type inference is now aware of argument objects which allows for
more programs w/ refinements to typecheck. Additionally, working
with vector types and literals that are refined or need to have
properties about their length proven now works.
2017-04-22 18:45:22 -04:00
Sam Tobin-Hochstadt
ebb0770edf v6.9 HISTORY 2017-04-21 17:01:52 -04:00
Alex Knauth
2262eb9eaf provide for/flvector, for/extflvector, etc. as aliases for : versions (#534)
Since the type-checker can now handle their expansions.

* add typed/racket/flonum and provide typed for/flvector and for*/flvector from it

* add typed/racket/extflonum and provide typed for/extflvector and for*/extflvector from it
2017-04-21 09:35:29 -07:00