* 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
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.
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.
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.
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.)
Adds the following:
+ dependent function Types
+ some existential object support when applying
dependent functions
+ simplify linear arith support
+ add unsafe-require/typed/provide
* 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.
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.
* 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
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`.
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.
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.
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