Improve diagnostic message for negative old style octal literals#13056
Merged
mhegazy merged 2 commits intomicrosoft:masterfrom Dec 21, 2016
Merged
Conversation
cf7051e to
faf0bfe
Compare
Contributor
Author
|
@mihailik review please |
mihailik
approved these changes
Dec 21, 2016
| tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. | ||
| tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. | ||
| tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. | ||
| tests/cases/conformance/expressions/literals/literals.ts(25,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. |
RyanCavanaugh
approved these changes
Dec 21, 2016
mhegazy
reviewed
Dec 21, 2016
| return false; | ||
| } | ||
|
|
||
| export function isMinusPrefixUnaryExpression(node: Node): boolean { |
Contributor
There was a problem hiding this comment.
i would rather this would be isPrefixUniraryExpresssion that is a type guard, i.e.
function isPrefixUniraryExpresssion (node: Node): node is PrefixUnaryExpression {
return node.kind === SyntaxKind.PrefixUnaryExpression;
}And used as
const withMinus = isPrefixUniraryExpresssion(node.parent) && node.parent.operator === SyntaxKind.MinusToken;
Contributor
Author
There was a problem hiding this comment.
Thank you for review, @mhegazy. I will update it.
faf0bfe to
23faaff
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additional for #10101 and #13016