krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.1k stars 114 forks source link

Work around String metatype bug #95

Closed john-flanagan closed 1 month ago

john-flanagan commented 1 month 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 1 month ago

thanks @john-flanagan !

jflan-dd commented 1 month ago

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