Decide what to do when there are multiple types with the same name
fdiaz opened this issue ยท 3 comments
What should the tool return in general when there is a non top-level type?
final class Some {
}
struct Another {
struct Some { }
}
Should SwiftInspector always return the Another.Some
when looking for "Some" or only the top-level declaration?
@fdiaz let's say we just have one type but it has multiple initializers. We print the parameters for each initializer on a new line right?
For the type location command, what I'm doing is printing the location of each type I find on a new line. But that's easier I think since each type only has a single line of output. If I'm understanding this command correctly each type may have multiple lines of output.
Throwing out a strawman... what if we separated each distinct type by two newlines.
final class Some {
convenience init(myParam: Int) { /* ... */ }
init(oneParam: Int, myParam: Int) { /* ... */ }
}
struct Another {
struct Some {
init(anotherParam: String) { /* ... */ }
}
}
So this file could print out the following if you searched for Some
.
Int
Int, Int
String
In NestableTypeInfo
I defined a type as having a both a name: String
and a parentType: TypeDescription?
, which helps disambiguate. I'd move to NestableTypeInfo
as the standard for nestable types and close out this issue as resolved ๐
That could def help. This is indeed fixed at the Visitor level but not at the Commands level.