Skip to content

Fixed incorrect error on intersected number and string types#786

Merged
Perryvw merged 6 commits intomasterfrom
bugfix/number-intersection-fix
Jan 2, 2020
Merged

Fixed incorrect error on intersected number and string types#786
Perryvw merged 6 commits intomasterfrom
bugfix/number-intersection-fix

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented Jan 2, 2020

Fixes #782

const name = this.printIdentifier(expression.name);

chunks.push(prefix, ":", name, "(");
const prefix = this.printExpression(expression.prefixExpression);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about something like that to remove parenthesizing duplication?

Suggested change
const prefix = this.printExpression(expression.prefixExpression);
const prefix = this.printExpression(lua.isStringLiteral(expression.prefixExpression) ? expression.prefixExpression : lua.createParenthesizedExpression(expression.prefixExpression));;

Also, what about "foo".bar?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should not be affected by this PR, I'd prefer to keep that for the full parenthesis to printer change.

@Perryvw Perryvw merged commit 295d907 into master Jan 2, 2020
@Perryvw Perryvw deleted the bugfix/number-intersection-fix branch January 2, 2020 21:38
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.

Methods on types intersected with number cannot be used

2 participants