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
[SR-6787] Unexpected result when getting a String describing a type created inside a function #49336
Comments
Hm, I'm inclined to agree that the simple demangling shouldn't include the local discriminator, even though the name won't be unique. (It already doesn't include private discriminators, I believe.) @rjmccall, @eeckstein, what do you think? |
I agree. This makes sense for local types. The simplified demangling is ambiguous anyway. Although we should keep the #-numbering for closures, because it's not uncommon to have multiple closures in the same function. |
Good call. Okay, I'm going to mark this as a Starter Bug because the fix will look a lot like SR-6032. |
Comment by Timur Islamgulov (JIRA) It looks like behaviour has been changed. Given snippet produces the following output: TestA
TestB And print(String(reflecting: type(of: b))) prints: String.(unknown context at 0x100001eec).TestB If I'm not mistaken, this is where new behaviour has been introduced. |
:-( @jckarter, you've regressed printing of local types. Want a separate bug for that? |
I changed it intentionally. The new presentation is unambiguous and allows for eventual anonymization of type metadata. |
Sorry i didn't see this bug sooner. |
Uh, hm. Previously you could use the printed representation for debugging purposes to get back to where the type was declared. Is that not interesting anymore? (I know, I know, normally I'm the secrecy one, but I'm coming around to the idea that it'll be opt-in.) |
With the new context descriptor format, we do have some flexibility to decide how much context information we preserve at runtime. We could generate nested |
Environment
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 8c7915ab890e09c28c37e2e83c70c057
relates to:
Issue Description:
When a type is declared inside a function (or a closure), trying to get String describing a type of its instance unexpectedly returns a String with weird « #1» addition.
When trying to get String(reflecting🙂, it returns
Which gives a little insight to what’s going on.
The text was updated successfully, but these errors were encountered: