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

2nd-level import reports errors at 1st-level import's call-site to l2 #110

Open
rjharmon opened this issue Nov 2, 2023 · 3 comments
Open

Comments

@rjharmon
Copy link

rjharmon commented Nov 2, 2023

script: import {foo} from foo; ... foo()

foo:

import {bar} from bar;   ...func foo() { 
   ... bar() // "line 42" 
}

bar:

   // ...
   print("hi"); // or error()
   stuff.get("thing-not-found") 

I'm expecting all the issues in bar to be reported at sites in bar, but are reported at foo "line 42" instead. Nothing catastrophic, but for good modularity support...

@christianschmitz
Copy link
Contributor

Do you have the complete output from running this program?

@rjharmon
Copy link
Author

rjharmon commented Nov 4, 2023

added in private thread

@christianschmitz
Copy link
Contributor

I'm unable to replicate this.

I'm using the following test:

import { Program } from "@hyperionbt/helios";

export default async function test() {
    const program = Program.new(`
    testing nested_modules

    import { foo } from Foo

    func main() -> Bool {
        foo()
    }
    `, [
        `
        module Foo
        
        import { bar } from Bar
        func foo() -> Bool {
            print("foo");
            bar()
        }
        `,
        `module Bar
        
        func bar() -> Bool {
            if (1 == 1) {
                error("bar")
            };
            true
        }`
    ]);

    console.log((await program.compile(false).run([])).toString())
}

test()

The printed output is:

INFO (Foo:6:18) foo
INFO (Bar:5:22) bar
Error: thrown during UPLC evaluation
INFO (Foo:6:18) foo
ERROR (Bar:5:22) bar
TRACE (Bar:4:13)
TRACE (Foo:7:16)
TRACE (nested_modules:7:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants