Skip to content

Parser: allow on-demand member decl parsing for other nominal types. #19260

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 11 commits into from
Sep 13, 2018

Conversation

nkcsgexi
Copy link
Contributor

No description provided.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@slavapestov
Copy link
Contributor

Can you add -parse to scale_test and write some tests for this as we discussed?

@nkcsgexi
Copy link
Contributor Author

@slavapestov sure, I'm looking into that.

@@ -186,7 +186,9 @@ void PersistentParserState::parseMembers(IterableDeclContext *IDC) {
SourceFile &SF = *IDC->getDecl()->getDeclContext()->getParentSourceFile();
assert(!SF.hasInterfaceHash() &&
"Cannot delay parsing if we care about the interface hash.");
assert(SF.Kind != SourceFileKind::SIL && "cannot delay parsing SIL");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to have a way to keep SILParserState around till delayed parsing, which requires non-trivial work. I don't think there're fundamental blockers there, just we need to keep track more stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, fair enough. Can you add a comment somewhere to that effect? We don’t care about SIL parsing performance much anyway, I was just curious.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 8a28fec56efc38a45141f0b28b9e5a7a9e37d348

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 8a28fec56efc38a45141f0b28b9e5a7a9e37d348

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@slavapestov I've added a scale test. It passes when delayed body parsing is enabled and fails when it's not.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 8cdfddcafc7a95b2cb522ca2c15329277bbc1d7c

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 8cdfddcafc7a95b2cb522ca2c15329277bbc1d7c

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@nkcsgexi
Copy link
Contributor Author

@swift-ci Please Test Source Compatibility

@swift-ci
Copy link
Contributor

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

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3f03202

@nkcsgexi
Copy link
Contributor Author

All tests passed. Merging

@nkcsgexi nkcsgexi merged commit c94bc1d into swiftlang:master Sep 13, 2018
@dcci
Copy link
Member

dcci commented Sep 13, 2018

@nkcsgexi This seems to have broken a lldb test that runs only in the full run. Mind if we take a look together?

@dcci
Copy link
Member

dcci commented Sep 13, 2018

Trying to get a reduced testcase.

@nkcsgexi
Copy link
Contributor Author

@dcci Thanks for working on a reduced test case! I think we specifically disabled delayed parsing for REPL input here: https://github.com/apple/swift/blob/master/lib/Parse/ParseDecl.cpp#L3372.

@dcci
Copy link
Member

dcci commented Sep 13, 2018

In the meanwhile, @vedantk / @fredriss there's a bug in the test suite, as this is a REPL inline test, and should be run as part of the "regular" PR cycle. [cc:ing you as you did some work in the last month in the area]

@dcci
Copy link
Member

dcci commented Sep 13, 2018

This doesn't reproduce on the REPL from the cmdline, it could be a bug in the SBAPI.

Davides-Mac-Pro:bin davide$ ./lldb --repl
Welcome to Swift version 4.2-dev (LLVM 7b8e4a2b59, Clang 61c26a2ab2, Swift 1e499bf5a9).
Type :help for assistance.
  1> class A {init(a: Int) {}}
  2> class B : A {let x: Int; init() { x = 5 + 5; super.init(a: x) } }
  3> B().x
$R0: Int = 10
  4> extension B : CustomStringConvertible { public var description:String { return "class B\(x) is a subclass of class A"} }
  5> B().description
$R1: String = "class B10 is a subclass of class A"

@vedantk
Copy link
Contributor

vedantk commented Sep 13, 2018

This test is in test/testcases/repl/subclassing/TestREPLSubclassing.py. It doesn't run because we pass --test-subdir lang/swift to dotest. I'll move it.

@vedantk
Copy link
Contributor

vedantk commented Sep 13, 2018

(Well, I'll set up a PR to move it; done correctly, it won't pass smoke testing until we fix the underlying issue here.)

@dcci
Copy link
Member

dcci commented Sep 13, 2018

@vedantk thanks for the explanation!

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.

5 participants