Open ashtonmeuser opened 2 years ago
At first glance it looks like the type compatibility check in the gdscript parser only checks for parent-child relationships, not siblings?
You can avoid the warning by casting to the super class:
var _dummy: DummySuper = DummySub0.new() as DummySuper if true else DummySub1.new() as DummySuper
Still happens on Godot 4b12. The workaround works for now.
Godot version
3.4.4
System information
macOS 10.15.7
Issue description
Sibling classes extending the same base class report incompatible types when assigning using a ternary. A warning is produced stating the following.
The same does not occur for a ternary producing type of superclass or subclass as follows.
Steps to reproduce
Minimal reproduction project
ternary_repro.zip