Skip to content

Sema: Don’t use ‘.’ in symbol names of synthesized properties #5998

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

Closed
wants to merge 1 commit into from

Conversation

eeckstein
Copy link
Contributor

Instead use ‘$’.

@eeckstein
Copy link
Contributor Author

@swift-ci Please smoke test

@eeckstein
Copy link
Contributor Author

@jckarter Can you please review this?

@jrose-apple
Copy link
Contributor

This is no good, $ is a valid identifier character.

@jrose-apple
Copy link
Contributor

What's prompting this? Problems with mangling? Problems with the SIL parser?

@jckarter
Copy link
Contributor

jckarter commented Dec 1, 2016

$ isn't a valid Swift identifier character. The problem was that the . was leaking into mangled symbol names, and so far we've been trying to keep mangled symbols restricted to the commonly-supported [A-Za-z0-9_$] character set.

@jckarter
Copy link
Contributor

jckarter commented Dec 1, 2016

@eeckstein I do think though that it'd be better to mangle unexpected characters like . by mapping them to $ in the mangling rather than changing the AST names. It is useful to synthesize AST nodes with impossible identifiers for names.

@rintaro
Copy link
Member

rintaro commented Dec 1, 2016

Since #5270
We can

let `$storage` = 1
print(`$storage`)

@jckarter
Copy link
Contributor

jckarter commented Dec 1, 2016

I don't think we ever allowed $ as anything other than the first character, though.

@rintaro
Copy link
Member

rintaro commented Dec 1, 2016

$ in middle of identifiers is allowed even in Swift2.3/3.0, even without backticks.

let foo$storage = 1
print(foo$storage)

@jckarter
Copy link
Contributor

jckarter commented Dec 1, 2016

Well, that's arguably a bug we should fix (for future Swift versions) in line with #5270.

@jrose-apple
Copy link
Contributor

:-/ Perhaps. I wish we had a good way to search for that one first.

(We could also do some kind of silly substitution, like $ -> $$, . -> $.)

@jckarter
Copy link
Contributor

jckarter commented Dec 1, 2016

Alternatively, we could treat . and all other nonstandard identifier characters as if they were Unicode code units and Punycode them out-of-band. That would also allow us to accept arbitrary strings in a backtick-quoted identifier, if we wanted to…

@eeckstein
Copy link
Contributor Author

ok, no problem, I'll handle it in the mangling

@eeckstein eeckstein closed this Dec 1, 2016
@eeckstein eeckstein deleted the dollar_instead_dot branch April 17, 2021 15:01
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