-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace InterfaceType
with FacetType
#4499
Conversation
…value" This reverts commit 39bf354.
@@ -8,19 +8,39 @@ | |||
// TIP: To dump output, run: | |||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon | |||
|
|||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+10]]:1: error: semantics TODO: `impl as non-interface` [SemanticsTodo] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, losing this diagnostic seems like a regression to me, since it's the clearest explanation of what's wrong with this code, but we can presumably circle back to that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diagnostic was not particularly targeted before. It would print this anytime there was any error in the expression after the as
.
Co-authored-by: Geoff Romer <[email protected]>
Co-authored-by: Geoff Romer <[email protected]>
This was broken by #4499 . --------- Co-authored-by: Josh L <[email protected]>
This does a few things:
TypeId
in theFacetTypeInfo
struct with a vector ofInterfaceId
,SpecificId
pairs (sorted in id order) representing the set of interface requirements of the facet type. This will later be used to support facet types with multiple interface requirements (as inI & J
orI where .Self impls J
).InterfaceType
instructions (used as the type of anInterfaceDecl
instruction) withFacetType
instructions (introduced in Add facet type values and an instruction that produces them #4460) with a (newly introduced)FacetTypeFromInterface()
function.InterfaceType
values with code that consumedFaceType
values. I've generally left the assumption in the code that it is dealing with a single interface, using the (newly introduced)FacetTypeInfo::TryAsSingleInterface
, and producing an error otherwise. There isn't yet support for the&
operator orwhere .Self impls
, so this is generally a good assumption for now, except you can get a facet type with no associated interfaces from atype where
... expression. In some cases, the facet type value is pulled from the evaluation of anInterfaceDecl
instruction, where the single interface assumption will hold permanently.There is still a lot left to do, including:
type
should be a facet type with a reserved id, replacing the built-in instruction.TryAsSingleInterface
should generally be upgraded to handle more than (or less than) one interface. Name lookup should be particularly exciting.&
should be defined on facet types, unioning their interface and other requirements.where
clause don't do anything yet.