the following program compiles and works as expected.
function foo() -> bool? => match 0 {
1 => false
else => None
}
function main() {
let a = foo()
}
however, if you take off the return type, it fails in the c++ compiler
runtime/lib.h:225:17: error: no matching constructor for initialization of 'ExplicitValue<bool>'
: value(ExplicitValue<Value> { move(v.value) })
^ ~~~~~~~~~~~~~~~~~
build/test.cpp:13:8: note: in instantiation of function template specialization 'JaktInternal::ExplicitValueOrControlFlow<bool, bool>::ExplicitValueOrControlFlow<Jakt::NullOptional>' requested here
return JaktInternal::ExplicitValue(JaktInternal::OptionalNone());
^
runtime/lib.h:198:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Jakt::NullOptional' to 'const JaktInternal::ExplicitValue<bool>' for 1st argument
struct ExplicitValue {
^
runtime/lib.h:198:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'Jakt::NullOptional' to 'JaktInternal::ExplicitValue<bool>' for 1st argument
struct ExplicitValue {
^
runtime/lib.h:199:5: note: candidate constructor not viable: no known conversion from 'Jakt::NullOptional' to 'bool' for 1st argument
ExplicitValue(Value&& v)
^
runtime/lib.h:203:5: note: candidate constructor not viable: no known conversion from 'Jakt::NullOptional' to 'const bool' for 1st argument
ExplicitValue(Value const& v)
^
1 error generated.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too