mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When applying a solution to a nil literal of Optional type, we would build a direct reference to Optional<T>.none instead of leaving the NilLiteralExpr in place, because this would generate more efficient SIL that avoided the call to the Optional(nilLiteral: ()) witness. However, a few places in the type checker build type-checked AST, and they build NilLiteralExpr directly. Moving the peephole to SILGen's lowering of NilLiteralExpr allows us to simplify generated SIL even further by eliding an unnecessary metatype value. Furthermore, it allows SILGen to accept NilLiteralExprs that do not have a ConcreteDeclRef set, which makes type-checked AST easier to build.
211 KiB
211 KiB