#2320 Compilation Err when using Facet with null value

SlimerDude Thu 24 Jul 2014

I get a compilation Err when trying to use a Facet with a null value:

facet class MyFacet {
    const Str? value
}

@MyFacet { value = null }
class MyClass { }

gives

Invalid type for facet field 'value': expected 'sys::Str?' not 'sys::Obj?'

As a workaround I can cast the null:

@MyFacet { value = (Str?) null }
class MyClass { }

But it's not very convenient. :(

Jens Thu 24 Jul 2014

I encountered and reported the same problem some time ago:

http://fantom.org/sidewalk/topic/1988

Login or Signup to reply.