Skip to content

Provide clear error message that generics are not allowed in ABI declarations #7703

Description

@ironcev

E.g., this compiles without any errors:

contract;

abi Abi {
    fn fun_1<T>() -> bool;
    fn fun_2<T>() -> bool where T: PartialEq;
}

This gives confusing errors:

contract;

abi Abi {
    fn fun<T>(t1: T, t2: T) -> bool where T: PartialEq;
                  ^
Could not find symbol "T" in this scope.
}

The upper two examples that compile if we have only ABI definition compile with error without any explanations if the ABI gets implemented for Contract:

contract;

abi Abi {
    fn fun_1<T>() -> bool;
    fn fun_2<T>() -> bool where T: PartialEq;
}

impl Abi for Contract {
    fn fun_1<T>() -> bool {
        true
    }
    
    fn fun_2<T>() -> bool where T: PartialEq {
        true
    }
}

error
: 
Could not generate the entry method. See errors above for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgen

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions