xamarin / binding-tools-for-swift

MIT License
160 stars 21 forks source link

[types] Don't compare "any" we can't guarantee that we have it. #780

Closed stephen-hawley closed 1 year ago

stephen-hawley commented 1 year ago

When I stubbed in support for any I put in a comparator in TypeSpec. This creates a couple issues. The first is that when I reflect on a module using the .swiftinterface file, I will get any tags that I hadn't put in the original code. There's added by the swift compiler as a 'service'. If I'm looking for a wrapper function that I wrote, the original won't have any. Second, when I import functions the .dylib file, there are no any tags in the mangled signature.

My choices here are to:

  1. Add any tags when I write functions (possible, but tricky to get right in all cases, especially generics or tuples that are nested: Foo<Bar<Baz<any SomeProtocol>>> and to add any tags toSwiftType` used from .dylib files (tricky for the same reasons)
  2. Make comparisons ignoring Any (expedient)

Since I don't see any particular downside to 2, I went with that.