Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hold error/warning messages while trying to unify call arguments #8476

Merged

Conversation

RealyUniqueName
Copy link
Member

@RealyUniqueName RealyUniqueName commented Jun 25, 2019

Fixes #5522
Fixes #6937

class Test {
    static function f(?i:Int, fn:Array<Dynamic>-> Void){
    }

    static function main() {
        // this does not compile, with `You can't iterate on a Dynamic value, please specify Iterator or Iterable`
        f(function(res){
            for (a in res){}
        });
    }
}

This happens because it attempts to type function(res)... against ?i:Int first. Then it fails and tries to type it against fn:Array<Dynamic>-> Void and succeeds. But error messages from the first attempt already have been added to compilation result.
This PR adds a function to hold error/warning messages until it's known those messages should be submitted or discarded.

@RealyUniqueName RealyUniqueName added this to the Release 4.0 milestone Jun 25, 2019
@skial skial mentioned this pull request Jun 26, 2019
1 task
@Simn Simn modified the milestones: Release 4.0, Release 4.1 Jun 27, 2019
@Simn
Copy link
Member

Simn commented Jun 27, 2019

This is a bit too much of a central change for me to consider for 4.0. I have some concerns about the with err and the new exception type. The other issue is that we might cause inference damage that doesn't raise errors immediately.

@RealyUniqueName
Copy link
Member Author

This change doesn't prevent exceptions to be raised. It only stops messages to be immediately written to Server.context.messages.

@Simn
Copy link
Member

Simn commented Feb 17, 2020

Brunch needs opdating.

@Simn Simn merged commit 72eb9c1 into HaxeFoundation:development Feb 18, 2020
RealyUniqueName added a commit that referenced this pull request Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-feedback We need more information to deal with this issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing optional argument before function does not compile Leading optional arguments mess up inference.
2 participants