Bad diagnostic
dabrahams opened this issue · comments
public trait CollectionCore {}
public trait Collection: CollectionCore {
type SliceCore: CollectionCore
subscript slice(_ start: Int, _ end: Int): SliceCore { let }
}
extension Collection {
subscript(_ start: Int, _ end: Int): SliceCore {
yield Slice<Self>(core: self.slice[start, end]) // <=== Actual problem is here.
}
}
type Slice<Base: Collection> {
var core: SliceCore
memberwise init
typealias SliceCore = Base.SliceCore // error: type 'Base' has no member 'SliceCore'
}
@dabrahams would you have a suggestion? Otherwise please assign this to issue to yourself, since it is not very actionable.
Report a problem on the indicated line instead of telling me my type doesn't have a member that it clearly does have?
Then it's not a bad diagnostic issue. The problem in your extension is preventing name resolution to do its job. It's a bug.
It's a bug that results in a bad diagnostic; I'm not in a position to root-cause these things, but if you want to change the title of the issue to describe the problem better, please do.
This bug seems fixed. When I compile it now it points to the line that @dabrahams commented with "Actual problem is here."
Examples/test2.hylo:13.11-52: error: incompatible types 'Self.SliceCore' and 'Slice<Self>'
yield Slice<Self>(core: self.slice[start, end]) // <=== Actual problem is here.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think this issue can be closed.