simit-lang/simit

Strange type inference error message

fredrikbk opened this issue · 2 comments

The following incorrect code gets very strange error messages:

func asm(e : Edge, p : (Vertex*2)) -> A : tensor[V,E](int)
  A(e, p(0)) = 1;
  A(e, p(1)) = 1;
end
Error: element declared to be of type 'Edge' but inferred to be of type 'Vertex', at 12:14-17
Error: element declared to be of type 'Vertex' but inferred to be of type 'Edge', at 12:25-30

I would expect it to report that the wrong types are used to index into A. Instead it seems to try to infer the type of the arguments.

@stephenchouca fyi, but certainly not expedient!

I can look into it. It doesn't look like it will take too long to change that.