Previously, most of it was actually deterministic enumeration, which meant
repeating the same tests over and over again. We still want to run those,
if only to catch regressions, so now we run both enumeration and truly
random tests, separately.
This does mean that the set of tests being run for a given seed is not the
same as it used to, so old seeds won't give the same results as before.
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.
When identifiers provided by typed modules were used in
certain submodules of the form (module* n #f ...) or were
used by modules implemented in a language defined by TR,
the wrong redirection was used in the expansion.
The reason was because TR's identifier redirection decided
whether it was in a typed or untyped context at module visit
time, but that's too early in the cases above.
(because TR's #%module-begin may not have begun expanding yet)
The fix uses a rename-transformer that delays the decision
to use the typed or untyped identifier until expansion time.
Closes GH issue #163 and #181
Closes PR 15118
Moves `get-alternate` since its only user is the require-contract
module. In addition, it appears that one of the cases in the
conditional in its body is unnecessary. This likely means that
the extra machinery for typed-renamers are not needed at all.
Also adds a test for `require/typed` of a typed module
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
I had forgotten to adjust the define-struct macro to work
like the struct macro for the #:prefab keyword, which made
TR think prefabs were ordinary structs.
Closes GH issue #188
Previous version replaced calls to, e.g., `cadr` with calls to `cdr`
then `car`, called the typechecker to populate the type table, then
optimized the exploded operations. The call to the typechecker failed
on open terms, limiting the applicability of the optimization, and was
just generally brittle.
The new version instead explodes operations, then optimizes them inside
out for as long as the argument's type guarantees it's safe. This works
on open terms, and should be more robust.
In the case that a let rhs doesn't return and therefore the
bodies of the let are unreachable, the bodies need to be marked
as ignored for the optimizer.
In addition, don't attempt unboxed let optimization at all
if the return type is Nothing since it probably means some
body expressions have no type.
Closes GH issue #165
The old check was broken for cases with type constructors
with more than one type argument and was also too conservative
in some cases (e.g., when one cycle refers to another cycle of
aliases in a non-recursive manner).
The new check is still conservative, but it allows more types
than before.
Closes GH issue #157
Because -let-internal wasn't rename-out'd, users would see its name in
syntax error messages. Adding #:context forces the error messages to be
phrased in terms of the given form.
Since these promises re-evaluate their bodies every time they
are forced, allowing them makes `force` not idempotent and not
safe to treat as a path.
This change is slightly backwards-incompatible, since programs
that previously passed `delay/name` promises across the typed
boundary will now fail at runtime. The alternative is also
incompatible: stop treating `force` as a path. Since `delay/name`
is quite obscure, this approach seems like the safer choice.
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.
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.
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 ...)`.
Previously the restriction didn't account for traversing
the object type with the given path. This also relies on
the previous commit that adds subtyping on filters.
(because this change seems to introduce filters which
only differ by an unrolling of a recursive type, but
the old subtyping only worked for identical types)
This makes a type like
(-> Any Boolean : #:+ Integer)
a subtype of a type like
(-> Any Boolean : #:+ Number)
For not filters, the direction is reversed.
Allow more cases that are allowed for ordinary function
contracts and explicitly error instead of internal errors
for other cases.
Closes Github Issue #50