Conversation
lolleko
requested changes
Aug 15, 2021
| /** @tupleReturn */ | ||
| function tuple(): [number, number, number] { return [3, 5, 1]; } | ||
| return tuple()[2]; | ||
| `.expectDiagnosticsToMatchSnapshot([annotationRemoved.code]); |
Member
There was a problem hiding this comment.
Add a test for just:
/** @tupleReturn */
function tuple(): [number, number, number] { return [3, 5, 1]; };
(without the call). This should also result in a diagnostic
| if (signature) { | ||
| if (getSignatureAnnotations(context, signature).has(AnnotationKind.TupleReturn)) { | ||
| context.diagnostics.push(annotationDeprecated(node, AnnotationKind.TupleReturn)); | ||
| context.diagnostics.push(annotationRemoved(node, AnnotationKind.TupleReturn)); |
Member
There was a problem hiding this comment.
I think diagnostic.push should be removed from isTupleReturnCall(). isTupleReturnCall should just return true or false without side effects.
The diagnostic should only be pushed at the call location of isTupleReturnCall().
e.g.
if (isTupleReturnCall()) {
context.diagnostic.push...
}
Which seems to already be the case???? https://github.com/TypeScriptToLua/TypeScriptToLua/pull/1090/files#diff-877ef39cd04cebdd5a0baf7a2090e119498765d5afc71abe08f32422d1dd1984R252
I wonder why the test does not fail because with this implementation, the diagnostic should get pushed multiple times?
lolleko
approved these changes
Aug 16, 2021
sanikoyes
pushed a commit
to sanikoyes/TypeScriptToLua
that referenced
this pull request
Sep 24, 2021
* Remove tupleReturn annotation * Change places tuplereturn diagnostics are added
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As a side effect of removing
isInTupleReturn, this also fixes #1058