You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dyno: support for partial type instantiations (#27861)
This PR resolves most of the issues in `test/types/partial`, __except__
`test/types/partial/formals`, which is caused by
Cray/chapel-private#7669.
We simply didn't have code written to support partial instantiations.
Previously, invoking any type constructor reset any previously applied
substitutions. Thus:
```Chapel
record triple { type fst; type snd; type thd; }
type a = triple(int, ?);
type b = a(bool, ?);
type c = b(real, ?);
```
Produced `a = triple(int, ?)`, `b = triple(bool, ?)` and `c =
triple(real, ?)`. This is not correct.
This PR makes the following adjustments.
* When a type constructor is invoked, inserts the existing substitutions
of the type into the call. This mirrors the logic for invoking `new` on
a partial instantiation. The calling code already knows when defaults
should or should not be included.
* The exception to the above is that in inheritance expressions, we for
some reason computed the type of `A` in `A(?)` as `A(A's defaults)`.
This was not needed or relied on anywhere, so I removed it.
* Detects cases in which are are invoking a type constructor, but don't
know the type. This can happen in initial signatures, where the
type-to-be-constructed its given by a preceding formal. In this case, we
know the intent to be `TYPE`, but the `Type*` is `UnknownType`. Signal
this case from `CallInfo::create`, and defer resolution to instantiation
where necessary.
* Allowed `init=`'s lhs to be partially generic. We clearly allow this
(in, e.g., `var r: R(t1, ?) = ...`).
* Allow the RHS of `init=` to be a `param`. We clearly allow this (see
`test/types/partial/initeq.chpl`).
## Testing
- [x] dyno tests
- [x] paratest
- [x] paratest --dyno-resolve-only (down to 54 failures to resolve
working programs)
Reviewed by @benharsh -- thanks!
0 commit comments