Merged
Conversation
uses typeEnsure functions to ensure correct types at all times the intermediate language is not the same as in JASS, so compiletime execution is not correct
The typeEnsure functions have no effect on compiletime, so lua compiletime should now be exactly like JASS compiletime. index type is ensured with intEnsure this effectively makes generics integers like in JASS casting type parameters to/from int still uses lua functions, even though they are already integers, so it would not be necessary
compiletime results are initially evaluated to 0 for objects that are null in lua the 0 must be replaced with nil
use entry type for arrays and member type for member variables
use regular expressions to only check the functions of interest and ignore other parts of the output
Indexing table literals only works with parentheses around them.
Member
|
As we discussed in DMs, I will merge this even if the implementation might not be ideal, since it makes the lua backend finally usable and new generics/type classes still seem a bit far in the future. |
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 is an attempt to fix the lua bugs described in #994 and #995 (outside of the null string issue).
I marked it WIP, because it contains parts that can be improved, needs some clean up and better unit tests. My understanding of the code base is limited, so I'm sure there is lots of stuff that should be done differently.
I will summarize the changes and how it works:
typeFromIndex(...)->typeFromIndex(intEnsure(...))andtypeToIndex(...) -> intEnsure(typeToIndex(...))If for example
HashMap.getnow returns nil (the indexToObject function will return nil for non existing keys), the intEnsure function that is wrapped aroundHashMap.getwill convert nil to 0.While these functions are added to the intermediate program in lua, the program is still semantically the same as without these function, because they are just identity functions for the intermediate language.
This could serve as temporary fix until the new generics are implemented. If this is considered useful I can do some improvements, but I didn't want to spend more time on something that may not be of use.