Skip to content
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

Disallow case string interpolation #10496

Merged
merged 1 commit into from Nov 21, 2021
Merged

Conversation

RblSb
Copy link
Member

@RblSb RblSb commented Nov 20, 2021

Maybe complex string interpolation expression should be generated here with do_format_string call, but typing cannot be called easily without refactoring (recursive dependency)?
Closes #9163

| String (value,kind) when kind = Ast.SSingleQuotes ->
let e = ctx.g.do_format_string ctx value p in
begin match e with
| EBinop _, p -> typing_error "String interpolation is not allowed in case patterns" p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that '$foo' becomes a binop... But I suppose it's fine to rely on that and if we ever change it we can just update the check here in some way.

@Simn Simn merged commit a9fbf53 into HaxeFoundation:development Nov 21, 2021
@RblSb RblSb deleted the case_strings branch November 21, 2021 09:59
@skial skial mentioned this pull request Nov 24, 2021
1 task
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.

String expansion in case expression
2 participants