mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
Koltin generator fails with "'copy' overrides nothing." for subclasses of abstract class #178
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @juriad on GitHub (Jul 6, 2024).
Try generating Kotlin classes for this template:
The classes
WeekendandWorkdaycontain copy methods:but the class
Daywhich they extend:does not define
copymethod, which leads to a compilation error:It looks like the logic to skip generation of
copymethods for abstract classes is flawed.When making the hierarchy deeper:
it even fails to build with "Cannot create an instance of an abstract class." (apart from
'copy' overrides nothing.). This case should also be considered when fixing the implementation ofcopy.Marking
Dayasopeninstead ofabstractcan be used to work around this issue.@holzensp commented on GitHub (Jul 15, 2024):
Doesn't a
copymethod require that the class is instantiable? I would not expect acopymethod on anabstractclass.The spurious
overridedoes seem to be a bug (but I'd say a separate one).@odenix commented on GitHub (Oct 17, 2024):
I’ll send a PR that fixes both of the bugs reported here.