gooofy / aqb

A BASIC Compiler and IDE for Amiga Computers
MIT License
74 stars 7 forks source link

Compiler crash with "string" + int_var #17

Closed tomxp411 closed 2 years ago

tomxp411 commented 2 years ago

I discovered a way to crash the compiler with the following message:

assertion "0" failed: file "frontend.c", line 726, function: coercion Program aborted

Attempting to concatenate an integer type to a string will do this every time. For example: DIM n AS INTEGER PRINT "HELLO " + n

If I use the type correct "HELLO " + STR$(n), the program seems to work as expected.

The expected result would be either a compiler error (since you can't concatenate strings and numeric types) or an automatic widening conversion (ie: an implicit STR$(n)).

gooofy commented 2 years ago

thanks for the report - should be fixed now

https://github.com/gooofy/aqb/commit/a5e29756de4ea24ff0f7e8170f023c139930a8a1