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

Functions used before their declaration _sometimes_ aren't found #2779

Open
sezna opened this issue Sep 13, 2022 · 0 comments
Open

Functions used before their declaration _sometimes_ aren't found #2779

sezna opened this issue Sep 13, 2022 · 0 comments
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen

Comments

@sezna
Copy link
Contributor

sezna commented Sep 13, 2022

I just ran into this while doing testing for my other PR, thought I'd drop it here. Repro:

script;

const ADDRESS = 0x1234123412341234123412341234123412341234123412341234123412341234;

fn main() -> u64 {
  let caller: ContractCaller<SomeAbi> = abi(SomeAbi, get_addr());
  caller.baz();
  return 42;
}

abi SomeAbi {
  fn baz() -> u32;
  fn quux() -> u64;
}

fn get_addr() -> b256 {
  ADDRESS
}

image

Moving get_addr earlier fixes the error.

@anton-trunov anton-trunov added the compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
Projects
None yet
Development

No branches or pull requests

2 participants