bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

Incorrect variance checks when converting between function types #664

Open HurryStarfish opened 2 months ago

HurryStarfish commented 2 months ago

Bug Report

It seems bcc has the co- and contravariance for return types and parameter types backwards when checking whether a function type is assignable from another.

Expected Behavior

Local f:String(s:Object)
Local f_:Object(o:String) = f

should compile without complaints.

Local f:Object(o:String)
Local f_:String(s:Object) = f

should be a type error.

Actual Behavior

It's the other way round