File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ // This is just an example and documentation of how -parse-stdlib implicitly imports the Builtin module.
2+ // Note that a lot of builtins expect some types to be defined in the stdlib, otherwise the builtin will be unavailable.
3+ // Therefore "-module-name Swift" is significant (otherwise the types won't be find in the module we're building).
4+ //
5+ // Example:
6+ // %target-swift-emit-ir -parse-stdlib %s
7+ // Builtin.unreachable() // <<< error: module 'Builtin' has no member named 'unreachable'
8+ //
9+ // The real problem is that the 'unreachable' builtin needs the Never type (that's its return type).
10+ //
11+ // Example:
12+ // %target-swift-emit-ir -parse-stdlib -module-name Swift %s
13+ // enum Never {}
14+ // Builtin.unreachable() // works
15+
16+ // RUN: %target-swift-emit-ir -parse-stdlib -module-name Swift %s
17+
18+ enum Never { }
19+
20+ Builtin . unreachable ( )
21+ Builtin . int_trap ( )
You can’t perform that action at this time.
0 commit comments