mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[BUG] Type using associated alias of mutually recursive other type isn't recognised as `CollectionElement`

Open soraros opened this issue 11 months ago • 1 comments

Bug description

As title.

Steps to reproduce

from collections import Optional

@value
struct A(CollectionElement):
  var val: B.T

struct B:
  alias T = Int
  var val: Optional[A]  # error: 'Optional' parameter #0 has 'CollectionElement' type, but value has type 'A'

Replacing B.T with Int solves the problem.

System information

Mojo 24.1 on Docker, Intel Mac

soraros avatar Mar 17 '24 01:03 soraros