Closed npwoods closed 3 months ago
Thanks for the bug report. I can reproduce it.
It needs two files to be reproduced:
treeview.slint:
export global MyFluentPalette {
property <bool> dark-color-scheme: {
return false;
}
out property <brush> control-foreground: dark-color-scheme ? #FFFFFF : #000000E6;
}
main.slint
import { MyFluentPalette } from "treeview.slint";
export component AppWindow inherits Window {
out property <bool> foo: MyFluentPalette.dark-color-scheme ? true : false;
}
Looks like property of global exported in another file are not properly handled
This happens for global on other files because then the property can be inlined, but it can also be reproduced by one file with a private property
export component AppWindow inherits Window {
property <bool> xxx: {
return false;
}
out property <string> foo: xxx ? "true" : "false";
}
The problem is that the condition contains a return:
foo: if ({ return false; }) { "true" } else { "false" }
Not only the returned is not removed, but it is wrong to inline returns
The remove return pass needs to be done before const propagation
Steps to reproduce:
cargo build
bug-demo.zip