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
func update<T>(value: inout T, update: (inout T) -> Void) { | |
update(&value) | |
} | |
struct Hoge { | |
var list: List<Int> | |
} | |
enum List<T> { | |
case `nil` |
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
---Constraint solving for the expression at [test.swift:1:14 - line:1:14]--- | |
---Initial constraints for the given expression--- | |
(integer_literal_expr type='$T0' location=test.swift:1:14 range=[test.swift:1:14 - line:1:14] value=0) | |
Score: 0 0 0 0 0 0 0 0 0 0 0 0 | |
Contextual Type: Int at [test.swift:1:8 - line:1:8] | |
Type Variables: | |
$T0 [inout allowed] literal=3 bindings={(subtypes of) (default from ExpressibleByIntegerLiteral) Int} @ locator@0x7faa21801000 [[email protected]:1:14] | |
Active Constraints: |
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
.section __TEXT,__text,regular,pure_instructions | |
.macosx_version_min 10, 13 | |
.intel_syntax noprefix | |
.globl _main ## -- Begin function main | |
.p2align 4, 0x90 | |
_main: ## @main | |
.cfi_startproc | |
## BB#0: | |
push rbp | |
Lcfi0: |
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 MyClass { | |
var value: Int? { | |
willSet { | |
precondition(self.value == nil) } | |
} | |
} | |
} |
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
*** SIL module before Guaranteed Passes transformation (0) *** | |
// unwrapByEq(_:) | |
sil @_T02Eq08unwrapByA0ySiSgF : $@convention(thin) (Optional<Int>) -> () { | |
// %0 // users: %5, %1 | |
bb0(%0 : $Optional<Int>): | |
debug_value %0 : $Optional<Int>, let, name "optional", argno 1 // id: %1 | |
// function_ref Bool._getBuiltinLogicValue() | |
%2 = function_ref @_T0Sb21_getBuiltinLogicValueBi1_yF : $@convention(method) (Bool) -> Builtin.Int1 // user: %17 | |
// function_ref != infix<A>(_:_:) | |
%3 = function_ref @_T0s2neoiSbxSg_ABts9EquatableRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : Equatable> (@in Optional<τ_0_0>, @in Optional<τ_0_0>) -> Bool // user: %13 |
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
protocol MyComparable { | |
static func < (lhs: Self, rhs: Self) -> Bool | |
static func >= (lhs: Self, rhs: Self) -> Bool | |
} | |
extension MyComparable { | |
static func < (lhs: Self, rhs: Self) -> Bool { | |
return !(rhs >= lhs) | |
} | |
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
protocol NonEmptyHList { | |
associatedtype Head | |
associatedtype Tail | |
} | |
struct NEHLCons<H, T: NonEmptyHList>: NonEmptyHList { | |
typealias Head = H | |
typealias Tail = T | |
let head: H |
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
typealias Int = MyInt | |
struct MyInt: ExpressibleByIntegerLiteral, Equatable { | |
typealias IntegerLiteralType = Swift.Int | |
let value: Swift.Int | |
init(integerLiteral value: Swift.Int) { | |
self.value = value | |
} |
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
---Constraint solving for the expression at [sub.swift:4:11 - line:4:15]--- | |
(increasing score due to function conversion) | |
(overload set choice binding ($T1) -> $T0 := () -> Dog) | |
---Initial constraints for the given expression--- | |
(call_expr type='Dog' location=sub.swift:4:11 range=[sub.swift:4:11 - line:4:15] arg_labels= | |
(type_expr type='Dog.Type' location=sub.swift:4:11 range=[sub.swift:4:11 - line:4:11] typerepr='Dog') | |
(tuple_expr type='()' location=sub.swift:4:14 range=[sub.swift:4:14 - line:4:15])) | |
Score: 0 0 0 0 1 0 0 0 0 0 0 0 0 | |
Type Variables: | |
#0 = $T0 [inout allowed] as Dog |
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
protocol Animal { | |
func bark() | |
} | |
struct Dog: Animal { | |
func bark() { | |
print("わんわん") | |
} | |
} |
NewerOlder