New functions - interface recursion#287
Merged
Perryvw merged 22 commits intoTypeScriptToLua:new-functionsfrom Nov 29, 2018
Merged
New functions - interface recursion#287Perryvw merged 22 commits intoTypeScriptToLua:new-functionsfrom
Perryvw merged 22 commits intoTypeScriptToLua:new-functionsfrom
Conversation
…gning to untyped vars
Perryvw
approved these changes
Nov 29, 2018
Member
Perryvw
left a comment
There was a problem hiding this comment.
Missing some tests for all this stuff still
| new TranspileError(`Unsupported conversion from method to function.`, node) | ||
| public static UnsupportedFunctionConversion = (node: ts.Node, name?: string) => { | ||
| if (name) { | ||
| return new TranspileError(`Unsupported conversion from method to function "${name}".`, node); |
Member
There was a problem hiding this comment.
Maybe this error should be something like 'Can not implicitly convert method to function, to explicitly convert, wrap function call in a lambda function.'
Collaborator
Author
There was a problem hiding this comment.
Yeah, I figured this could be improved upon a lot once we've nailed things down.
Collaborator
Author
|
I actually have a file with a plethora of tests I'm using to validate as I go. Once things are locked in I'll convert it to proper functional tests and commit them. |
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.
This PR addresses the issue where assignment validation would incorrectly pass when assigning an object to an interface type where methods had mismatched context parameters:
Validation now recurses into interface and class types to check the methods being assigned. To avoid an infinite loop for recursive types, a cache is used to track previous comparisons. This has the fringe benefit of improving performance in code with a lot of assignments using the same types.
Additionally, the name of the function/method is now passed to the error when it occurs in an interface assignment. This is useful for tracking down the offending member in complex interface assignments.