swift
065eb832 - [Playground] Missing playground results for `init` and `deinit` in a class wrapped in a struct (#77498)

Commit
334 days ago
[Playground] Missing playground results for `init` and `deinit` in a class wrapped in a struct (#77498) The problem here is when wrapping a type that has constructors and destructors inside another type. The reason is that the playground transform uses an `ASTWalker` to get to the top-level structure, but then once it’s inside a type, it does directly nested transformDecl() calls. And that inner check was for too narrow of a type. The problem in this case was that the `dyn_cast<FuncDecl>(D)` was too narrow and didn’t include constructors/destructors. We want `dyn_cast<AbstractFunctionDecl>(D)`. We should probably resolve this duality (using an `ASTWalker` to get to the top-level decls but then using directly nested calls below) at some point, but that’s a larger change, and so the specific problem covered by this commit is worth addressing with this safer short-term fix. Changes: - change a `dyn_cast<FuncDecl>` to a `dyn_cast<AbstractFunctionDecl>` in PlaygroundTransform.cpp - add a unit test nested init and deinit (this test also tests the unnested case) rdar://137316110
Author
Parents
Loading