krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.36k stars 118 forks source link

Work around String metatype bug #95

Closed john-flanagan closed 5 months ago

john-flanagan commented 5 months ago

There's a bug that causes a crash when attempting to print the description of a type with a stored "thin" metatype: https://github.com/swiftlang/swift/issues/62003

Here's a trivial example that demonstrates the crash and also shows that using a computed works around the issue

enum E {}

struct Good {
    var e: E.Type { E.self }
}
struct Bad {
    let e: E.Type = E.self
}

print("\(Good())") // prints "Good()"
print("\(Bad())") // crashes

Alternatively we could replace the InjectionConfiguration.Type property entirely as suggested here: https://github.com/krzysztofzablocki/Inject/pull/20#issuecomment-1102306265

krzysztofzablocki commented 5 months ago

thanks @john-flanagan !

jflan-dd commented 5 months ago

@krzysztofzablocki Could you make a bugfix release to make this change easier to consume in our app?