array type checking just assumes that whatever is being returned from an indexed id that is array type will be its unit type equivalent. so a[1] would be expected to return chan even though in reality, its chan[]
proposed change:
b-chan = a[0]~ no error
c-chan = a[1]~ error, expected chan, got chan[]
d-chan = a[0][0][0][0]~ error, cannot index into chan
caveats
can only evaluate indexed id if the index are any of the ff: int/float/bool literals
if the index is a id, id.property, and indexed[id], or fn/method call, it will fall back on the original assume that whatever is being returned from an indexed id that is array type will be its unit type equivalent
current
array type checking just assumes that whatever is being returned from an indexed id that is array type will be its unit type equivalent. so
a[1]
would be expected to returnchan
even though in reality, itschan[]
proposed change:
b-chan = a[0]~
no errorc-chan = a[1]~
error, expectedchan
, gotchan[]
d-chan = a[0][0][0][0]~
error, cannot index intochan
caveats
id
,id.property
, andindexed[id]
, or fn/method call, it will fall back on the original assume that whatever is being returned from an indexed id that is array type will be its unit type equivalent