Skip to content

Generalize accessor storage to preserve the original accessor list. #17238

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
Jun 17, 2018

Conversation

rjmccall
Copy link
Contributor

Only not NFC because it's detectable by source tools.

@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b814ca34db8d401ab7082235ee06dd985effd534

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b814ca34db8d401ab7082235ee06dd985effd534


/// Either 0, meaning there is no registered accessor of the given kind,
/// or the index+1 of the accessor in the accessors array.
AccessorIndex AccessorIndices[NumAccessorKinds];
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use llvm::TrailingObjects instead of a supposed fixed-sized array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a fixed-size array; it's indexed by AccessorKinds. There is a trailing-objects use in that type, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, my brain misread NumAccessorKinds as MaxNumAccessors. Sorry for the noise!

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've updated to use TrailingObjects for the part that's actually a trailing array.

@rjmccall rjmccall force-pushed the full-accessor-lists branch 2 times, most recently from 3f1e547 to 841e69b Compare June 15, 2018 19:56
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

2 similar comments
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 841e69b2b041173ac037cce57434613f149b7350

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 841e69b2b041173ac037cce57434613f149b7350

@rjmccall rjmccall force-pushed the full-accessor-lists branch from 841e69b to 3c44d64 Compare June 15, 2018 22:15
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 841e69b2b041173ac037cce57434613f149b7350

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 841e69b2b041173ac037cce57434613f149b7350

@rjmccall rjmccall force-pushed the full-accessor-lists branch from 3c44d64 to 33014de Compare June 16, 2018 02:26
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3c44d6477ef3d9e49dc12e40302d6ade6d628b3f

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3c44d6477ef3d9e49dc12e40302d6ade6d628b3f

@rjmccall rjmccall force-pushed the full-accessor-lists branch from 33014de to fc64f54 Compare June 16, 2018 04:31
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 33014de6b1f4427afbf48c69a0c25556dcc92fd1

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 33014de6b1f4427afbf48c69a0c25556dcc92fd1

@rjmccall rjmccall force-pushed the full-accessor-lists branch from fc64f54 to 7f259cc Compare June 16, 2018 07:16
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fc64f5400fa71be44524f8ead8fc1609132f0dbb

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - fc64f5400fa71be44524f8ead8fc1609132f0dbb

@@ -4367,13 +4367,14 @@ public class FooOverlayClassDerived : Foo.FooOverlayClassBase {
{
key.kind: source.lang.swift.decl.var.global,
key.accessibility: source.lang.swift.accessibility.public,
key.setter_accessibility: source.lang.swift.accessibility.public,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benlangmuir @nkcsgexi I'm pretty sure that these changes are good — these are the global aliases we emit for C enumerators, so (1) they're not settable and (2) they do have the body {get} IIUC — but they're not intentional, so I'd feel better with a thumbs up. :)

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 understand why these changes occurred now. The generated interface file contains snippets like var x: Int {get} in all sorts of contexts. If you ask Swift to parse this, it will usually reject it because the accessor does not have a body. Previously, the parser wouldn't even make an AccessorDecl for the accessor, with two effects: first, there's no AST node for the syntax library to associate with the syntax, leading it to state that the variable has no body; and second, the parser sees a variable with no accessors and mistakenly decides it must be stored, and all stored variables are settable. My patch preserves the incomplete accessor declaration and properly considers the variable to be computed, leading to these changes. This is a clear improvement in our output.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@rjmccall rjmccall force-pushed the full-accessor-lists branch from 7f259cc to de4d56b Compare June 16, 2018 19:22
@rjmccall
Copy link
Contributor Author

Test failure is a consequence of other changes. Rebasing and resubmitting.

@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7f259ccdd9057fcff94fbcb2173814e1aa99dc3d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7f259ccdd9057fcff94fbcb2173814e1aa99dc3d

@rjmccall rjmccall force-pushed the full-accessor-lists branch 2 times, most recently from 36ad0c3 to 5506a1a Compare June 16, 2018 20:53
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - de4d56b2d8fdc4e9501b0a1f4b781d06920ff51b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - de4d56b2d8fdc4e9501b0a1f4b781d06920ff51b

Only not NFC because it's detectable by source tools.
@rjmccall rjmccall force-pushed the full-accessor-lists branch from 5506a1a to 69f4dd1 Compare June 16, 2018 22:16
@rjmccall
Copy link
Contributor Author

@swift-ci Please test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 5506a1a968cf58abdbf72f7e3e1a05427b7ee5e5

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 5506a1a968cf58abdbf72f7e3e1a05427b7ee5e5

@rjmccall rjmccall merged commit 08e8fb0 into swiftlang:master Jun 17, 2018
@rjmccall rjmccall deleted the full-accessor-lists branch June 17, 2018 01:16
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.

4 participants