Strange syntax error for string interpolation in attributes
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
``` hack
<>
function f() { }
```
This results in a somewhat strange syntax error in HHVM (the typechecker accepts it):
`Fatal error: syntax error, unexpected '"', expecting ')'` (on the first line)
We should figure out what to do with strings like that. I don't think it makes sense to actually do interpolation, which I think is what the parser is trying to do. We could treat double-quoted strings just like single-quoted strings in that context (the inconsistency bothers me a little, but then again we do the same thing in XHP attributes), or we could just disallow double-quoted strings in that context (again, inconsistent, and causes irritation for people who want strings with lots of apostrophes).
I'm ambivalent, but this particular error definitely seems like not the right answer.
Contributor guide
Assessment
This issue has not been assessed yet.