Gidsss / UwUIDE

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

Feat/array type conversions #197

Closed am-cid closed 6 months ago

am-cid commented 6 months ago

main change

etc


comprehensive test of feature:

sample text file
-----------------------------------------
1  |
2  |     cwass Hololive() [[ a-san~ ]]
3  |     fwunc mainuwu-san() [[
4  |         z-chan~
5  |         y-chan[] = {z}~
6  |         a-chan[] = {nuww}~
7  |         a = {nuww}~
8  |         b-chan[] = {}~
9  |         b = {}~
10 |         c-Hololive[] = {nuww}~
11 |         c = {nuww}~
12 |         d-Hololive[] = {}~
13 |         d = {}~
14 |         sum({})~
15 |         sum({nuww})~
16 |     ]]
17 |     fwunc sum-chan[](num-chan[]) [[
18 |         wetuwn({nuww})~
19 |     ]]
20 |     fwunc sum2-chan[](num-chan[]) [[
21 |         wetuwn({})~
22 |     ]]
23 |
-----------------------------------------
end of file

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

Declaration Type Mismatch: expected 'chan[]' but got 'san[]'
        _______________________________
             |    Expected type defined here
        6    |         a-chan[] = {nuww}~
             |           ^^^^^^
             | __________|
             | |  Tried to assign a value that evaluates to type: 'san[]'
        6..n | |    a-chan[] = {nuww}
             | |               ^^^^^^
             | |_______________|
        _______________________________

Assignment Type Mismatch: expected 'chan[]' but got 'san[]'
        _______________________________
             |    Expected type defined here
        6    |         a-chan[] = {nuww}~
             |           ^^^^^^
             | __________|
             | |  Tried to assign a value that evaluates to type: 'san[]'
        7..n | |    a = {nuww}
             | |        ^^^^^^
             | |________|
        _______________________________

Declaration Type Mismatch: expected 'Hololive[]' but got 'san[]'
        _____________________________________
              |    Expected type defined here
        10    |         c-Hololive[] = {nuww}~
              |           ^^^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'san[]'
        10..n | |    c-Hololive[] = {nuww}
              | |                   ^^^^^^
              | |___________________|
        _____________________________________

Assignment Type Mismatch: expected 'Hololive[]' but got 'san[]'
        _____________________________________
              |    Expected type defined here
        10    |         c-Hololive[] = {nuww}~
              |           ^^^^^^^^^^
              | __________|
              | |  Tried to assign a value that evaluates to type: 'san[]'
        11..n | |    c = {nuww}
              | |        ^^^^^^
              | |________|
        _____________________________________

Call arg type mismatch:
        _________________________________________
           |    'sum()' function defined here
        17 |     fwunc sum-chan[](num-chan[]) [[
           |               ^^^^^^
           | ______________|
           | |
           | |  'sum()' called here
        15 | |        sum({nuww})~
           | |        ^^^
           | |________|
           |
           |    'sum()' function expects 1 argument
           |    EXPECTED    ACTUAL       ARG
           |    ✗ chan[]    ( san[] )    {nuww}
        _________________________________________

Return Type Mismatch: expected 'chan[]' but got 'san[]'
        _________________________________________
            |   Expected return type: 'chan[]'
        17  |     fwunc sum-chan[](num-chan[]) [[
            |               ^^^^^^
            | ______________|
            | |
            | | Value below evaluates to type: 'san[]'
        ret | |    wetuwn({nuww})~
            | |           ^^^^^^
            | |___________|
        _________________________________________