Skip to content

[ASTPrinter] Don't print inferred opaque result type witness #31821

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

Merged
merged 1 commit into from
May 15, 2020

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented May 15, 2020

Opaque result type syntax is not usable except at the declaration itself. In other places, users need to let them inferred. Or, if they are used as associated types, they can only be referred by the name of the associated types.

In substType(), if a type witness is found to be a opaque result type, use the interface type of the witness decl which is a implicit typealias decl/type.

rdar://problem/59817674
rdar://problem/62232092

@rintaro
Copy link
Member Author

rintaro commented May 15, 2020

@swift-ci Please smoke test

@rintaro rintaro force-pushed the ide-completion-rdar59817674 branch from 2d3e0e3 to 90867c2 Compare May 15, 2020 19:15
Opaque result type syntax is not usable except the declaration of
itself. In other places, users need to let them inferred. If they are
inferred associated type, they need to reffered by the name of the
associated type.

rdar://problem/59817674
@rintaro rintaro force-pushed the ide-completion-rdar59817674 branch from 90867c2 to 29398b1 Compare May 15, 2020 19:16
@rintaro
Copy link
Member Author

rintaro commented May 15, 2020

@swift-ci Please smoke test

@rintaro rintaro requested a review from benlangmuir May 15, 2020 20:04
value.#^POSTFIX_ConcreteTestProtocol2^#
// POSTFIX_ConcreteTestProtocol2: Begin completions
// POSTFIX_ConcreteTestProtocol2-DAG: Keyword[self]/CurrNominal: self[#ConcreteTestProtocol2#];
// POSTFIX_ConcreteTestProtocol2-DAG: Decl[InstanceMethod]/CurrNominal: foo()[#Comparable#];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I understand the issue with override completions, but why does it impact member completion type annotation?

Copy link
Member Author

@rintaro rintaro May 15, 2020

Choose a reason for hiding this comment

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

Do you mean why this is printed as Comparable instead of some Comparable? If so, that's because we decided not to print some when it was introduced.

Or why bar()[#ConcreteTestProtocol2.Assoc#]? This is actually a side effect of my change, but when thinking about baz({#x: ConcreteTestProtocol2.Assoc#})[#(ConcreteTestProtocol2.Assoc) -> ConcreteTestProtocol2.Assoc#], I think It's better than (Comparable) -> Comparable because the result function doesn't accept arbitrary Comparable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean why this is printed as Comparable instead of some Comparable? If so, that's because we decided not to print some when it was introduced.

This is what I meant, thanks for explaining. I forgot that, and I misread some of the other test cases to think this was making it inconsistent.

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