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

[BUG] Incorrect error location. #486

Open
social-anthrax opened this issue Sep 18, 2024 · 3 comments
Open

[BUG] Incorrect error location. #486

social-anthrax opened this issue Sep 18, 2024 · 3 comments
Labels
bug Something isn't working compiler

Comments

@social-anthrax
Copy link

Describe the bug
version: amber 0.3.5-alpha
amber seems to throw an error when importing std/array.

To Reproduce

When running

import * from "std/text"
import { color_echo, exit, echo_info, error } from  "std/env"
import * from "std/array"

amber throws

ERROR  Expected iterable
at std/array:4:28
in ./sync.ab:6:1

Expected behavior
Expected behaviour would be to import the array std lib.

@social-anthrax social-anthrax added the bug Something isn't working label Sep 18, 2024
@social-anthrax social-anthrax changed the title [BUG] [BUG] Incorrect error location. Sep 18, 2024
@social-anthrax
Copy link
Author

Please disregard the previous error. It seems that there is instead a bug with the displayed location of where a bug occurs.

The broken code was later in the file and caused due to merge_output being a string and not an array.

    let merge_output = $git merge upstream/master$ failed {
        error("Failed to merge upstream into patched version", status)
    }

    if includes(merge_output, "Already up to date") { 
        echo_success("Patched version is already up to date with remote.")
        exit(0)
    } else {
        echo_success("Succesfully upstream repo into patched version")
    }

Expected behaviour

It would be expected that the error would show at the includes line instead of the import location.

@b1ek
Copy link
Member

b1ek commented Sep 22, 2024

in ./sync.ab:6:1

is that the line on which you have if includes(merge_output, "Already up to date")?

@Mte90 Mte90 added the compiler label Sep 23, 2024
@Mte90
Copy link
Member

Mte90 commented Sep 23, 2024

Probably the error should says "Expected iterable for function includes at first parameter".

@Ph0enixKM Ph0enixKM added this to the Amber 0.3.6-alpha milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler
Projects
None yet
Development

No branches or pull requests

4 participants