Commits
Ted Kremenek committed 1b2dfb79d45
Hack ClangImporter to *always* import "description", "debugDescription", and "hash" as properties.
This routes around temporary SDK discrepancies.
This change revealed some subtle issues with adding implicit property
definitions. A big challenge here is that 'description' is defined
in NSObject's protocol, so the implicit property needed to be
generated in all classes that conformed to the protocol. To make
things more complicated, some classes define 'description' themselves,
so we needed to take care to not generate the same implicit property
twice.
This change reveals a potential bug in the type checker. This now
crashes:
func bar(x: String) {
print(x)
}
func foo(x : AnyObject) {
print(x.description)
}
but this does not:
func bar(x: String) {
print(x)
}
func foo(x : NSObject) {
print(x.description)
}
This is due to the fact there is a class method "description()" and
a instance property "description" in the lookup on AnyObject.
Swift SVN r17454