Gidsss / UwUIDE

A compiler made to be cute uwu >~<
6 stars 0 forks source link

Fix/indexed id assignment #266

Closed am-cid closed 5 months ago

am-cid commented 6 months ago

assigning to indexed id expects either the unit type or array type

test log

sample text file
-------------------------------------
 1 |
 2 |     cwass Hololive() [[
 3 |         a-senpai[] = {"1", "2"}~
 4 |         fwunc arr-chan[]() [[
 5 |             wetuwn({})~
 6 |         ]]
 7 |     ]]
 8 |     fwunc mainuwu-san() [[
 9 |         a-Hololive = Hololive()~
10 |         b-chan[] = a.arr()~
11 |
12 |         a.a{0} = "0"~
13 |         a.a{1} = {"1"}~
14 |         b{0} = 0~
15 |         b{1} = {1}~
16 |
17 |         a.a{0} = 0~
18 |         a.a{1} = {1}~
19 |         b{0} = "0"~
20 |         b{1} = "1"~
21 |
22 |         z-senpai[] = "0"~
23 |         z = "1"~
24 |         z = {"2"}~
25 |         y-chan[] = 1~
26 |         y = 2~
27 |         y = {3}~
28 |     ]]
29 |
-------------------------------------
end of file

Assignment Type Mismatch: expected 'senpai' or 'senpai[]' but got 'chan'
        ______________________________________
              |    Expected type defined here
        3     |         a-senpai[] = {"1", "2"}~
              |           ^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'chan'
        17..n | |    a.a{0} = 0
              | |             ^
              | |_____________|
        ______________________________________

Assignment Type Mismatch: expected 'senpai' or 'senpai[]' but got 'chan[]'
        ______________________________________
              |    Expected type defined here
        3     |         a-senpai[] = {"1", "2"}~
              |           ^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'chan[]'
        18..n | |    a.a{1} = {1}
              | |             ^^^
              | |_____________|
        ______________________________________

Assignment Type Mismatch: expected 'chan' or 'chan[]' but got 'senpai'
        __________________________________
              |    Expected type defined here
        10    |         b-chan[] = a.arr()~
              |           ^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'senpai'
        19..n | |    b{0} = "0"
              | |           ^^^
              | |___________|
        __________________________________

Assignment Type Mismatch: expected 'chan' or 'chan[]' but got 'senpai'
        __________________________________
              |    Expected type defined here
        10    |         b-chan[] = a.arr()~
              |           ^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'senpai'
        20..n | |    b{1} = "1"
              | |           ^^^
              | |___________|
        __________________________________

Declaration Type Mismatch: expected 'senpai[]' but got 'senpai'
        ________________________________
              |    Expected type defined here
        22    |         z-senpai[] = "0"~
              |           ^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'senpai'
        22..n | |    z-senpai[] = "0"
              | |                 ^^^
              | |_________________|
        ________________________________

Assignment Type Mismatch: expected 'senpai[]' but got 'senpai'
        ________________________________
              |    Expected type defined here
        22    |         z-senpai[] = "0"~
              |           ^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'senpai'
        23..n | |    z = "1"
              | |        ^^^
              | |________|
        ________________________________

Declaration Type Mismatch: expected 'chan[]' but got 'chan'
        ____________________________
              |    Expected type defined here
        25    |         y-chan[] = 1~
              |           ^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'chan'
        25..n | |    y-chan[] = 1
              | |               ^
              | |_______________|
        ____________________________

Assignment Type Mismatch: expected 'chan[]' but got 'chan'
        ____________________________
              |    Expected type defined here
        25    |         y-chan[] = 1~
              |           ^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'chan'
        26..n | |    y = 2
              | |        ^
              | |________|
        ____________________________