ccrma / chuck

ChucK Music Programming Language
http://chuck.stanford.edu/
GNU General Public License v2.0
799 stars 127 forks source link

need runtime type check for casting #414

Closed gewang closed 8 months ago

gewang commented 9 months ago

bad...

SndBuf buffy;

buffy @=> Object @obj;

obj $ SinOsc @=> SinOsc @ uh;

// bad...
440 => uh.freq;
gewang commented 8 months ago

addressed in e879123b984a45996b84674d04263c333d9a6d84; part of 1.5.2.0

the above code now results in the following runtime exception

[chuck]:(EXCEPTION) RuntimeCastIncompatible: in shred[id=1:b.ck]...
b.ck:5:5: cannot cast dynamic type 'SndBuf' to 'SinOsc'...
[5] obj $ SinOsc @=> SinOsc @ uh;
        ^