Skip to content

Prevent crash with -playground when -experimental-skip-non-inlinable-function-bodies-without-types also passed #71171

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

Conversation

abertelrud
Copy link
Contributor

Skip playground transform for functions that have skipped bodies.

Discussion

This can happen when passing -emit-module and -experimental-skip-non-inlinable-function-bodies-without-types and also enabling the playground transform. This causes the type to be nullptr. The fix is for the playground transform to check AbstractFunctionDecl::isBodySkipped().

Changes

  • make the playground transform skip functions that return true for isBodySkipped
  • add a test to check that we prevent this crash

rdar://119258854

@abertelrud abertelrud self-assigned this Jan 26, 2024
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

…le-function-bodies-without-types` also passed

Skip playground transform for functions that have skipped bodies. This can happen when passing `-emit-module` and `-experimental-skip-non-inlinable-function-bodies-without-types` and also enabling the playground transform. This causes the type to be `nullptr`. The fix is for the playground transform to check `AbstractFunctionDecl::isBodySkipped()`.

rdar://119258854
@abertelrud abertelrud force-pushed the abertelrud/119258854-playground-crash-on-skipped-function-bodies branch from 7ee878b to 690568d Compare January 26, 2024 04:37
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test macOS

@abertelrud
Copy link
Contributor Author

abertelrud commented Jan 30, 2024

@slavapestov or @hborla or @xedin: any concerns with this? In addition to the unit test, I have tested locally with a compiler root. I have checked that this change addresses the problem for the case in which this was reported, and that it doesn't seem to negatively affect generating playground results elsewhere.

(I'm asking you three specifically as GitHub suggested you as reviewers).

@abertelrud abertelrud merged commit 192d275 into main Jan 30, 2024
@abertelrud abertelrud deleted the abertelrud/119258854-playground-crash-on-skipped-function-bodies branch January 30, 2024 19:37
@abertelrud
Copy link
Contributor Author

Thanks for the review and approval!

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