The compile error seems to be clearly saying that there is no overload that matches, despite the second overload clearly does. I must not be understanding something here.
I believe it’s relevant that I’m calling Item.new from inside the class (from a self.import
class method). Before I refactored the code to move the import inside the class, it was able to resolve the overload.
211 | hash[name] = Item.new(name, itype, slot, id)
^---
Error: expected argument 3 to 'Item.new' to be (Slot | Nil), not (String | Nil)
Overloads are:
- Item.new(name : String, itype : ItemType, slot : Slot | Nil, id : String | Nil)
- Item.new(name : String, itype : ItemType, slot : String | Nil, id : String | Nil)