This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run --privileged -it --rm norionomura/swift:4120180201a | |
root@ed1c03d3a776:/# git clone https://github.com/realm/SwiftLint.git -b nn-swift-4.1 | |
Cloning into 'SwiftLint'... | |
remote: Counting objects: 23681, done. | |
remote: Compressing objects: 100% (165/165), done. | |
remote: Total 23681 (delta 95), reused 145 (delta 74), pack-reused 23440 | |
Receiving objects: 100% (23681/23681), 6.16 MiB | 1.70 MiB/s, done. | |
Resolving deltas: 100% (16180/16180), done. | |
Checking connectivity... done. | |
root@ed1c03d3a776:/# cd SwiftLint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
key.offset: 0, | |
key.length: 105, | |
key.diagnostic_stage: source.diagnostic.stage.swift.parse, | |
key.syntaxmap: [ | |
{ | |
key.kind: source.lang.swift.syntaxtype.keyword, | |
key.offset: 0, | |
key.length: 6 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum Error: CustomStringConvertible, Swift.Error { | |
case failed(subcommand: String, message: String, status: Int32) | |
var description: String { | |
switch self { | |
case let .failed(subcommand: subcommand, message: message, status: status): | |
return "`\(subcommand)` failed with status: \(status)\n\(message)" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mario { | |
enum State: RawState { | |
case normal = "normal" | |
case big = "big" | |
case fire = "fire" | |
case dead = "dead" | |
} | |
var state: State = .normal | |
var name: String { return "\(state.rawValue.name)マリオ" } | |
func hitEnemy() { state.rawValue.hitEnemy(self) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat <<EOF|swiftc -emit-sil -O -|swift demangle | |
import CoreFoundation | |
import Foundation | |
protocol Factory {} | |
extension Factory { | |
init(_ f: () -> Self) { | |
self = f() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `-O`あり | |
// Factory.init(() -> A) -> A | |
sil hidden @(extension in main):main.Factory.init (() -> A) -> A : $@convention(method) <Self where Self : Factory> (@owned @callee_owned () -> @out Self, @thick Self.Type) -> @out Self { | |
// %0 // user: %4 | |
// %1 // users: %4, %3 | |
bb0(%0 : $*Self, %1 : $@callee_owned () -> @out Self, %2 : $@thick Self.Type): | |
debug_value %1 : $@callee_owned () -> @out Self, let, name "f", argno 1, loc "<stdin>":3:12, scope 13 // id: %3 | |
%4 = apply %1(%0) : $@callee_owned () -> @out Self, loc "<stdin>":4:18, scope 14 | |
%5 = tuple (), scope 14 // user: %6 | |
return %5 : $(), loc "<stdin>":5:5, scope 14 // id: %6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git submodule update --init --recursive | |
Submodule 'ext/xcode-build-test-aaa' (https://github.com/omochi/xcode-build-test-aaa) registered for path 'ext/xcode-build-test-aaa' | |
Submodule 'ext/xcode-build-test-bbb' (https://github.com/omochi/xcode-build-test-bbb) registered for path 'ext/xcode-build-test-bbb' | |
Submodule 'ext/xcode-build-test-ccc' (https://github.com/omochi/xcode-build-test-ccc) registered for path 'ext/xcode-build-test-ccc' | |
Cloning into '/Users/norio/github/xcode-build-test-ddd/ext/xcode-build-test-aaa'... | |
Cloning into '/Users/norio/github/xcode-build-test-ddd/ext/xcode-build-test-bbb'... | |
Cloning into '/Users/norio/github/xcode-build-test-ddd/ext/xcode-build-test-ccc'... | |
Submodule path 'ext/xcode-build-test-aaa': checked out '2d6a3207c649c348133222910e6209832c423950' | |
Submodule path 'ext/xcode-build-test-bbb': checked out '054193df0080280cd3df03d88bf0a16acf7e8444' | |
Submodule 'ext/xcode-build-test-aaa' (github.com:omochi/xcode-build-test-aaa) registered for path 'ext/xcode-build-test-bbb/ext/xcode- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CheckNSNumberTests.swift | |
// CheckNSNumberTests | |
// | |
import XCTest | |
class CheckNSNumberTests: XCTestCase { | |
func test_objCTypeFromCFNumber() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal struct _NSSimpleObjCType: ExpressibleByStringLiteral { | |
fileprivate let staticString: StaticString | |
var rawValue: UnicodeScalar { | |
return staticString.unicodeScalar | |
} | |
var _objCType: UnsafePointer<Int8> { | |
return UnsafeRawPointer(staticString.utf8Start).assumingMemoryBound(to: Int8.self) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo 'func f(_ s: StaticString) { print(s) }; f("test")'|swiftc - -emit-assembly -O|swift demangle | |
.section __TEXT,__text,regular,pure_instructions | |
.macosx_version_min 10, 9 | |
.section __TEXT,__literal16,16byte_literals | |
.p2align 4 | |
LCPI0_0: | |
.quad 1 | |
.quad 2 | |
.section __TEXT,__text,regular,pure_instructions | |
.globl _main |