Skip to content

Conversation

@rudkx
Copy link
Contributor

@rudkx rudkx commented Sep 7, 2018

…r operators.

Parsing for these protocols in operator declarations is gated by
-enable-operator-designated-protocols (added in
#19145).

@rudkx
Copy link
Contributor Author

rudkx commented Sep 7, 2018

@swift-ci Please smoke test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be serialized as a Decl, not a Type, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that makes sense given that I am only using the type to get to the decl at this point. An earlier version of this added constructors for OperatorDecls that took TypeLocs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this has poor recovery (read: will crash) if the protocol can't be deserialized for whatever reason. That's probably fine for now, but really there should be a recovery mechanism.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a better approach? We seem to be doing something very similar in other places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look for the uses of getTypeChecked elsewhere in the file. Moving over to that for everything is a big task, but we probably want new fields to be thinking about recovery.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only skimmed your previous proposal, but this confuses me: an identifier isn't enough to uniquely identify a type, so why bother?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you're asking here, can you clarify?

@rudkx
Copy link
Contributor Author

rudkx commented Sep 10, 2018

I'll push another version of this once #19202 lands.

…r operators.

Parsing for these protocols in operator declarations is gated by
-enable-operator-designated-protocols (added in
#19145).
@rudkx
Copy link
Contributor Author

rudkx commented Sep 11, 2018

@swift-ci Please smoke test

@rudkx rudkx merged commit 3f74fbc into swiftlang:master Sep 12, 2018
@rudkx rudkx deleted the serialization-for-designated-protocols branch September 12, 2018 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants