-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use FacetAccessType when converting to a value of type FacetType
When attempting to convert to a value of type FacetType, and the source value is a FacetAccessType, then if the type of the underlying FacetValue is the same as the target, we can use the FacetValue there as the conversion output. If the type of the FacetValue differs, then we still want to do impl lookup with the FacetValue to see if it matches with the target FacetType, but that is still a TODO. This allows a generic function with a value whose type is constrained by a FacetType (thus the value's type is a FacetAccessType), to call other functions with the value as an argument when it is constrained by the same FacetType: ``` fn F[T:! FacetType](x: T); fn G[T:! FacetType](x: T) { F(x); } ``` It is also an optimization to avoid impl lookup where we've already done it to produce the FacetAccessType. Adds a bunch of new tests with values of types which are constrained by a facet type (or "facet value value" for short), with some more tests that currently fail and should be made to pass.
- Loading branch information
Showing
8 changed files
with
2,340 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 286 additions & 0 deletions
286
toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
327 changes: 327 additions & 0 deletions
327
.../check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
439 changes: 439 additions & 0 deletions
439
...uiltin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
357 changes: 357 additions & 0 deletions
357
...k/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
412 changes: 412 additions & 0 deletions
412
...eck/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
399 changes: 399 additions & 0 deletions
399
...builtin_conversions/no_prelude/fail_todo_convert_facet_value_value_to_blanket_impl.carbon
Large diffs are not rendered by default.
Oops, something went wrong.
181 changes: 94 additions & 87 deletions
181
...rsions/no_prelude/fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon
Large diffs are not rendered by default.
Oops, something went wrong.