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

Call checking #16

Closed
mrRachar opened this issue Aug 18, 2020 · 0 comments · Fixed by #28
Closed

Call checking #16

mrRachar opened this issue Aug 18, 2020 · 0 comments · Fixed by #28
Assignees
Labels
bug Something isn't working implemented Implemented, and on it's way to stable semantic check Problems with the semantic analysis stage urgent High priority and should be fixed ahead of other tasks

Comments

@mrRachar
Copy link
Collaborator

Currently no attempt is made to check the arity or types of parameters for calls. The following compiles:

contract Test { }

Test :: (any) {
    public init() {
        // None of the following should work, but all do
        test0(true)

        test1()
        test1(1)
        test1(true, 1)

        test2()
        test2(1)
        test2(true)
        test2(true, 3)
        test2(1, 2, 3)
    }

    func test0() -> Int {
        return 0
    }

    func test1(x: Bool) -> Int {
        return 1
    }

    func test2(x: Int, y: Int) -> Int {
        return 2
    }
}

It will, however, produce invalid target code. This issue is similar to #15 ''(Type checking)'' although also has issues with call arity, and the lack of proper call-site function inspection is also a problem for #6.

@mrRachar mrRachar added bug Something isn't working semantic check Problems with the semantic analysis stage urgent High priority and should be fixed ahead of other tasks labels Aug 18, 2020
@mrRachar mrRachar self-assigned this Aug 18, 2020
@mrRachar mrRachar added this to the Spec compatibility milestone Aug 18, 2020
@mrRachar mrRachar mentioned this issue Aug 18, 2020
5 tasks
mrRachar pushed a commit that referenced this issue Aug 19, 2020
 - Checks call arity and provided types, and produces more helpful error messages if not matched
 - New `scope_or_default()` on contexts will always produce a usable scope (replaces `.scope_context.as_ref().unwrap_or_default()`)
 - More conversions from wasteful `.collect()`s to plain `Iterators`, and optimisations to a more functional style
mrRachar pushed a commit that referenced this issue Aug 19, 2020
@mrRachar mrRachar added the implemented Implemented, and on it's way to stable label Aug 19, 2020
@egroge egroge linked a pull request Sep 10, 2020 that will close this issue
@egroge egroge mentioned this issue Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working implemented Implemented, and on it's way to stable semantic check Problems with the semantic analysis stage urgent High priority and should be fixed ahead of other tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant