Skip to content

Give an error message if function parameter is declared twice #1849

Description

@certik

This should give an error message that m is declared twice:

definit_X(m:i32, n: i32, b: CPtr, m: i32) ->None:
B: Pointer[i16[m*n]] =c_p_pointer(b, i16[m*n])
i: i32j: i32foriinrange(m):
forjinrange(n):
B[i*n+j] =i16((i+j) %m)

Clang gives the following error message on the generated code:

/Users/ondrej/repos/gsi/copperhead/benchmarks/matmul/build/mat_vec-host-generated.c:224:52: error: redefinition of parameter 'm'void init_X(int32_t m, int32_t n, void* b, int32_t m) ^/Users/ondrej/repos/gsi/copperhead/benchmarks/matmul/build/mat_vec-host-generated.c:224:21: note: previous declaration is herevoid init_X(int32_t m, int32_t n, void* b, int32_t m) ^

We should give a similar error message, underlying both declarations of m.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions