degory / ghul

compiler for the ghūl programming language
https://ghul.dev
GNU Affero General Public License v3.0
4 stars 0 forks source link

Null should not be assignment compatible with value types #1061

Closed degory closed 9 months ago

degory commented 9 months ago

Values of null type (created with the null literal) are wrongly assignment compatible with value types.

[ ] - null should not be assignable to variables, properties or indexers of value type [ ] - null should not be returnable from functions of value type return type [ ] - null should not be accepted as an actual argument for a parameter of value type

For these purposes, unconstrained generic type or function parameters are not value types - i.e. they should not be assignable from null