format icon indicating copy to clipboard operation
format copied to clipboard

Unmatched null pattern

Open Simn opened this issue 11 years ago • 0 comments

https://github.com/HaxeFoundation/format/blob/master/format/swf/Writer.hx#L547

bits.writeBit(switch(data.fill) {
    case LS2FColor(_):  false;
    case LS2FStyle(_):  true;
});

https://github.com/HaxeFoundation/format/blob/master/format/swf/Writer.hx#L570

switch(data.fill) {
    case LS2FColor(color):  writeRGBA(color);
    case LS2FStyle(style):  writeFillStyle(ver, style);
}

The error is correct because LS2Data defines fill to be Null<LS2Fill> and Haxe now considers explicit null types for exhaustiveness.

The question is what should semantically happen if the field actually is null. Or should the fill field not be nullable after all?

Simn avatar Apr 23 '14 08:04 Simn