-
-
Save dan-zheng/378403430d08c5a6471957cfc504bdcf to your computer and use it in GitHub Desktop.
SE-0253 bug: `mutating func callFunction` + IUO (https://github.com/apple/swift/pull/24299)
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
struct Mutating { | |
var x: Int | |
mutating func callFunction() { | |
x += 1 | |
} | |
} | |
func testIUO(f: inout Mutating!) { | |
f() // not okay | |
f.callFunction() // okay | |
} |
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
$ $SWIFT_BIN/swiftc -frontend -typecheck -debug-constraints mutating_iuo.swift | |
---Constraint solving for the expression at [mutating_iuo.swift:4:5 - line:4:10]--- | |
(overload set choice binding $T1 := @lvalue Mutating) | |
(overload set choice binding $T2 := @lvalue Int) | |
(common result type for $T0 is ()) | |
---Initial constraints for the given expression--- | |
(binary_expr type='()' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:5 - line:4:10] | |
(overloaded_decl_ref_expr type='$T0' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:7 - line:4:7] name=+= number_of_decls=24 function_ref=unapplied decls=[ | |
Swift.(file).String extension.+=, | |
Swift.(file).Float extension.+=, | |
Swift.(file).Double extension.+=, | |
Swift.(file).Float80 extension.+=, | |
Swift.(file).UInt8.+=, | |
Swift.(file).Int8.+=, | |
Swift.(file).UInt16.+=, | |
Swift.(file).Int16.+=, | |
Swift.(file).UInt32.+=, | |
Swift.(file).Int32.+=, | |
Swift.(file).UInt64.+=, | |
Swift.(file).Int64.+=, | |
Swift.(file).UInt.+=, | |
Swift.(file).Int.+=, | |
Swift.(file).Array extension.+=, | |
Swift.(file).FloatingPoint.+=, | |
Swift.(file).AdditiveArithmetic.+=, | |
Swift.(file).BinaryInteger.+=, | |
Swift.(file).Strideable extension.+=, | |
Swift.(file).SIMD extension.+=, | |
Swift.(file).SIMD extension.+=, | |
Swift.(file).SIMD extension.+=, | |
Swift.(file).SIMD extension.+=, | |
Swift.(file).RangeReplaceableCollection extension.+=]) | |
(tuple_expr implicit type='(@lvalue Int, $T3)' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:10] | |
(unresolved_dot_expr type='@lvalue Int' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:5] field 'x' function_ref=unapplied | |
(declref_expr implicit type='@lvalue Mutating' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:5] decl=mutating_iuo.(file).Mutating.callFunction().self@mutating_iuo.swift:3:17 function_ref=unapplied)) | |
(integer_literal_expr type='$T3' location=mutating_iuo.swift:4:10 range=[mutating_iuo.swift:4:10 - line:4:10] value=1 builtin_initializer=**NULL** initializer=**NULL**))) | |
Score: 0 0 0 0 0 0 0 0 0 0 0 0 | |
Type Variables: | |
$T0 [lvalue allowed] [noescape allowed] subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7] | |
$T1 [lvalue allowed] [noescape allowed] as @lvalue Mutating @ locator@0x7fb8fb4b35f0 [DeclRef@mutating_iuo.swift:4:5] | |
$T2 [lvalue allowed] [noescape allowed] as @lvalue Int @ locator@0x7fb8fb4b3680 [UnresolvedDot@mutating_iuo.swift:4:5 -> member] | |
$T3 [noescape allowed] fully_bound literal=3 involves_type_vars bindings={(subtypes of) (default from ExpressibleByIntegerLiteral) Int} @ locator@0x7fb8fb4b3798 [IntegerLiteral@mutating_iuo.swift:4:10] | |
$T4 [noescape allowed] as () @ locator@0x7fb8fb4b3888 [Binary@mutating_iuo.swift:4:7 -> function result] | |
Active Constraints: | |
Inactive Constraints: | |
disjunction [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]:$T0 bound to decl Swift.(file).String extension.+= : (String.Type) -> (inout String, String) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Float extension.+= : (Float.Type) -> (inout Float, Float) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Double extension.+= : (Double.Type) -> (inout Double, Double) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Float80 extension.+= : (Float80.Type) -> (inout Float80, Float80) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).UInt8.+= : (UInt8.Type) -> (inout UInt8, UInt8) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Int8.+= : (Int8.Type) -> (inout Int8, Int8) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).UInt16.+= : (UInt16.Type) -> (inout UInt16, UInt16) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Int16.+= : (Int16.Type) -> (inout Int16, Int16) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).UInt32.+= : (UInt32.Type) -> (inout UInt32, UInt32) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Int32.+= : (Int32.Type) -> (inout Int32, Int32) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).UInt64.+= : (UInt64.Type) -> (inout UInt64, UInt64) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Int64.+= : (Int64.Type) -> (inout Int64, Int64) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).UInt.+= : (UInt.Type) -> (inout UInt, UInt) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Int.+= : (Int.Type) -> (inout Int, Int) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Array extension.+= : <Element> (Array<Element>.Type) -> (inout Array<Element>, Array<Element>) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).FloatingPoint.+= : <Self where Self : FloatingPoint> (Self.Type) -> (inout Self, Self) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).AdditiveArithmetic.+= : <Self where Self : AdditiveArithmetic> (Self.Type) -> (inout Self, Self) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).BinaryInteger.+= : <Self where Self : BinaryInteger> (Self.Type) -> (inout Self, Self) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).Strideable extension.+= : <Self where Self : _Pointer> (Self.Type) -> (inout Self, Self.Stride) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).SIMD extension.+= : <Self where Self : SIMD, Self.Scalar : FixedWidthInteger> (Self.Type) -> (inout Self, Self) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).SIMD extension.+= : <Self where Self : SIMD, Self.Scalar : FixedWidthInteger> (Self.Type) -> (inout Self, Self.Scalar) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).SIMD extension.+= : <Self where Self : SIMD, Self.Scalar : FloatingPoint> (Self.Type) -> (inout Self, Self) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).SIMD extension.+= : <Self where Self : SIMD, Self.Scalar : FloatingPoint> (Self.Type) -> (inout Self, Self.Scalar) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; or $T0 bound to decl Swift.(file).RangeReplaceableCollection extension.+= : <Self, Other where Self : RangeReplaceableCollection, Other : Sequence, Self.Element == Other.Element> (Self.Type) -> (inout Self, Other) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
$T3 literal conforms to ExpressibleByIntegerLiteral [[locator@0x7fb8fb4b3798 [IntegerLiteral@mutating_iuo.swift:4:10]]]; | |
(@lvalue Int, $T3) -> $T4 applicable fn $T0 [[locator@0x7fb8fb4b3928 [Binary@mutating_iuo.swift:4:7 -> apply function]]]; | |
Resolved overloads: | |
selected overload set choice @lvalue Mutating.x: $T2 == @lvalue Int | |
selected overload set choice self: $T1 == @lvalue Mutating | |
($T3 fully_bound literal=3 involves_type_vars bindings={(subtypes of) (default from ExpressibleByIntegerLiteral) Int}) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).String extension.+= : (String.Type) -> (inout String, String) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout String, String) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Float extension.+= : (Float.Type) -> (inout Float, Float) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Float, Float) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Double extension.+= : (Double.Type) -> (inout Double, Double) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Double, Double) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Float80 extension.+= : (Float80.Type) -> (inout Float80, Float80) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Float80, Float80) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).UInt8.+= : (UInt8.Type) -> (inout UInt8, UInt8) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout UInt8, UInt8) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Int8.+= : (Int8.Type) -> (inout Int8, Int8) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Int8, Int8) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).UInt16.+= : (UInt16.Type) -> (inout UInt16, UInt16) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout UInt16, UInt16) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Int16.+= : (Int16.Type) -> (inout Int16, Int16) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Int16, Int16) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).UInt32.+= : (UInt32.Type) -> (inout UInt32, UInt32) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout UInt32, UInt32) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Int32.+= : (Int32.Type) -> (inout Int32, Int32) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Int32, Int32) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).UInt64.+= : (UInt64.Type) -> (inout UInt64, UInt64) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout UInt64, UInt64) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Int64.+= : (Int64.Type) -> (inout Int64, Int64) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Int64, Int64) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).UInt.+= : (UInt.Type) -> (inout UInt, UInt) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout UInt, UInt) -> ()) | |
) | |
(attempting disjunction choice $T0 bound to decl Swift.(file).Int.+= : (Int.Type) -> (inout Int, Int) -> () [[locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7]]]; | |
(overload set choice binding $T0 := (inout Int, Int) -> ()) | |
($T3 literal=3 bindings={(subtypes of) (default from ExpressibleByIntegerLiteral) Int}) | |
Initial bindings: $T3 := Int | |
(attempting type variable $T3 := Int | |
(found solution 0 0 0 0 0 0 0 0 0 0 0 0) | |
) | |
) | |
---Solver statistics--- | |
Total number of scopes explored: 16 | |
Maximum depth reached while exploring solutions: 3 | |
Time: 4.377000e+00ms | |
---Solution--- | |
Fixed score: 0 0 0 0 0 0 0 0 0 0 0 0 | |
Type variables: | |
$T4 as () @ locator@0x7fb8fb4b3888 [Binary@mutating_iuo.swift:4:7 -> function result] | |
$T3 as Int @ locator@0x7fb8fb4b3798 [IntegerLiteral@mutating_iuo.swift:4:10] | |
$T2 as @lvalue Int @ locator@0x7fb8fb4b3680 [UnresolvedDot@mutating_iuo.swift:4:5 -> member] | |
$T0 as (inout Int, Int) -> () @ locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7] | |
$T1 as @lvalue Mutating @ locator@0x7fb8fb4b35f0 [DeclRef@mutating_iuo.swift:4:5] | |
Overload choices: | |
locator@0x7fb8fb4b35f0 [DeclRef@mutating_iuo.swift:4:5] with mutating_iuo.(file).Mutating.callFunction().self@mutating_iuo.swift:3:17 as self: @lvalue Mutating | |
locator@0x7fb8fb4b3680 [UnresolvedDot@mutating_iuo.swift:4:5 -> member] with mutating_iuo.(file).Mutating.x@mutating_iuo.swift:2:7 as @lvalue Mutating.x: @lvalue Int | |
locator@0x7fb8fb4b2a00 [OverloadedDeclRef@mutating_iuo.swift:4:7] with Swift.(file).Int.+= as +=: (inout Int, Int) -> () | |
Constraint restrictions: | |
Disjunction choices: | |
---Type-checked expression--- | |
(binary_expr type='()' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:5 - line:4:10] | |
(dot_syntax_call_expr implicit type='(inout Int, Int) -> ()' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:7 - line:4:7] | |
(declref_expr type='(Int.Type) -> (inout Int, Int) -> ()' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:7 - line:4:7] decl=Swift.(file).Int.+= function_ref=unapplied) | |
(type_expr implicit type='Int.Type' location=mutating_iuo.swift:4:7 range=[mutating_iuo.swift:4:7 - line:4:7] typerepr='Int')) | |
(tuple_expr implicit type='(inout Int, Int)' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:10] | |
(inout_expr implicit type='inout Int' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:5] | |
(member_ref_expr type='@lvalue Int' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:5] decl=mutating_iuo.(file).Mutating.x@mutating_iuo.swift:2:7 | |
(declref_expr implicit type='@lvalue Mutating' location=mutating_iuo.swift:4:5 range=[mutating_iuo.swift:4:5 - line:4:5] decl=mutating_iuo.(file).Mutating.callFunction().self@mutating_iuo.swift:3:17 function_ref=unapplied))) | |
(integer_literal_expr type='Int' location=mutating_iuo.swift:4:10 range=[mutating_iuo.swift:4:10 - line:4:10] value=1 builtin_initializer=Swift.(file).Int.init(_builtinIntegerLiteral:) initializer=**NULL**))) | |
---Constraint solving for the expression at [mutating_iuo.swift:8:3 - line:8:5]--- | |
(overload set choice binding $T0 := @lvalue Mutating?) | |
---Initial constraints for the given expression--- | |
(call_expr type='$T1' location=mutating_iuo.swift:8:3 range=[mutating_iuo.swift:8:3 - line:8:5] arg_labels= | |
(declref_expr type='$T0' location=mutating_iuo.swift:8:3 range=[mutating_iuo.swift:8:3 - line:8:3] decl=mutating_iuo.(file).testIUO(f:).f@mutating_iuo.swift:7:14 function_ref=single) | |
(tuple_expr type='()' location=mutating_iuo.swift:8:4 range=[mutating_iuo.swift:8:4 - line:8:5])) | |
Score: 0 0 0 0 0 0 0 0 0 0 0 0 | |
Type Variables: | |
$T0 [lvalue allowed] [noescape allowed] subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fb4b2600 [DeclRef@mutating_iuo.swift:8:3] | |
$T1 [noescape allowed] fully_bound subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fb4b27f8 [Call@mutating_iuo.swift:8:3 -> function result] | |
Active Constraints: | |
Inactive Constraints: | |
disjunction (remembered) [[locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice]]]:$T0 bind @lvalue Mutating? [[locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice]]]; or $T0 bind @lvalue Mutating [[locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice]]]; | |
() -> $T1 applicable fn $T0 [[locator@0x7fb8fb4b2868 [Call@mutating_iuo.swift:8:3 -> apply function]]]; | |
Resolved overloads: | |
selected overload set choice f: $T0 == @lvalue Mutating? | |
(attempting disjunction choice $T0 bind @lvalue Mutating? [[locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice]]]; | |
(failed constraint () -> $T1 applicable fn $T0 [[locator@0x7fb8fb4b2868 [Call@mutating_iuo.swift:8:3 -> apply function]]];) | |
) | |
(attempting disjunction choice $T0 bind @lvalue Mutating [[locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice]]]; | |
(increasing score due to force of an implicitly unwrapped optional) | |
(overload set choice binding $T2 := () -> ()) | |
(found solution 0 0 0 1 0 0 0 0 0 0 0 0) | |
) | |
---Solver statistics--- | |
Total number of scopes explored: 3 | |
Maximum depth reached while exploring solutions: 2 | |
Time: 8.130000e-01ms | |
---Solution--- | |
Fixed score: 0 0 0 1 0 0 0 0 0 0 0 0 | |
Type variables: | |
$T2 as () -> () @ locator@0x7fb8fb4b2868 [Call@mutating_iuo.swift:8:3 -> apply function] | |
$T1 as () @ locator@0x7fb8fb4b27f8 [Call@mutating_iuo.swift:8:3 -> function result] | |
$T0 as @lvalue Mutating @ locator@0x7fb8fb4b2600 [DeclRef@mutating_iuo.swift:8:3] | |
Overload choices: | |
locator@0x7fb8fb4b2868 [Call@mutating_iuo.swift:8:3 -> apply function] with mutating_iuo.(file).Mutating.callFunction()@mutating_iuo.swift:3:17 as Mutating.callFunction: () -> () | |
locator@0x7fb8fb4b2600 [DeclRef@mutating_iuo.swift:8:3] with mutating_iuo.(file).testIUO(f:).f@mutating_iuo.swift:7:14 as f: @lvalue Mutating? | |
Constraint restrictions: | |
Disjunction choices: | |
locator@0x7fb8fb4b2690 [DeclRef@mutating_iuo.swift:8:3 -> implicitly unwrapped disjunction choice] is #1 | |
mutating_iuo.swift:8:3: error: cannot use mutating member on immutable value: 'f' is immutable | |
f() // not okay | |
^ | |
---Constraint solving for the expression at [mutating_iuo.swift:9:3 - line:9:18]--- | |
(overload set choice binding $T0 := @lvalue Mutating?) | |
---Initial constraints for the given expression--- | |
(call_expr type='$T2' location=mutating_iuo.swift:9:5 range=[mutating_iuo.swift:9:3 - line:9:18] arg_labels= | |
(unresolved_dot_expr type='$T1' location=mutating_iuo.swift:9:5 range=[mutating_iuo.swift:9:3 - line:9:5] field 'callFunction' function_ref=single | |
(declref_expr type='$T0' location=mutating_iuo.swift:9:3 range=[mutating_iuo.swift:9:3 - line:9:3] decl=mutating_iuo.(file).testIUO(f:).f@mutating_iuo.swift:7:14 function_ref=unapplied)) | |
(tuple_expr type='()' location=mutating_iuo.swift:9:17 range=[mutating_iuo.swift:9:17 - line:9:18])) | |
Score: 0 0 0 0 0 0 0 0 0 0 0 0 | |
Type Variables: | |
$T0 [lvalue allowed] [noescape allowed] subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fa820218 [DeclRef@mutating_iuo.swift:9:3] | |
$T1 [lvalue allowed] [noescape allowed] fully_bound subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fa820408 [UnresolvedDot@mutating_iuo.swift:9:5 -> member] | |
$T2 [noescape allowed] fully_bound subtype_of_existential involves_type_vars bindings={} @ locator@0x7fb8fa8204c8 [Call@mutating_iuo.swift:9:5 -> function result] | |
Active Constraints: | |
Inactive Constraints: | |
disjunction (remembered) [[locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice]]]:$T0 bind @lvalue Mutating? [[locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice]]]; or $T0 bind @lvalue Mutating [[locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice]]]; | |
$T0[.callFunction: value] == $T1 [[locator@0x7fb8fa820408 [UnresolvedDot@mutating_iuo.swift:9:5 -> member]]]; | |
() -> $T2 applicable fn $T1 [[locator@0x7fb8fa820538 [Call@mutating_iuo.swift:9:5 -> apply function]]]; | |
Resolved overloads: | |
selected overload set choice f: $T0 == @lvalue Mutating? | |
(attempting disjunction choice $T0 bind @lvalue Mutating? [[locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice]]]; | |
(failed constraint $T0[.callFunction: value] == $T1 [[locator@0x7fb8fa820408 [UnresolvedDot@mutating_iuo.swift:9:5 -> member]]];) | |
) | |
(attempting disjunction choice $T0 bind @lvalue Mutating [[locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice]]]; | |
(increasing score due to force of an implicitly unwrapped optional) | |
(overload set choice binding $T1 := () -> ()) | |
(found solution 0 0 0 1 0 0 0 0 0 0 0 0) | |
) | |
---Solver statistics--- | |
Total number of scopes explored: 3 | |
Maximum depth reached while exploring solutions: 2 | |
Time: 8.260000e-01ms | |
---Solution--- | |
Fixed score: 0 0 0 1 0 0 0 0 0 0 0 0 | |
Type variables: | |
$T1 as () -> () @ locator@0x7fb8fa820408 [UnresolvedDot@mutating_iuo.swift:9:5 -> member] | |
$T2 as () @ locator@0x7fb8fa8204c8 [Call@mutating_iuo.swift:9:5 -> function result] | |
$T0 as @lvalue Mutating @ locator@0x7fb8fa820218 [DeclRef@mutating_iuo.swift:9:3] | |
Overload choices: | |
locator@0x7fb8fa820408 [UnresolvedDot@mutating_iuo.swift:9:5 -> member] with mutating_iuo.(file).Mutating.callFunction()@mutating_iuo.swift:3:17 as @lvalue Mutating.callFunction: () -> () | |
locator@0x7fb8fa820218 [DeclRef@mutating_iuo.swift:9:3] with mutating_iuo.(file).testIUO(f:).f@mutating_iuo.swift:7:14 as f: @lvalue Mutating? | |
Constraint restrictions: | |
Disjunction choices: | |
locator@0x7fb8fa8202a0 [DeclRef@mutating_iuo.swift:9:3 -> implicitly unwrapped disjunction choice] is #1 | |
---Type-checked expression--- | |
(call_expr type='()' location=mutating_iuo.swift:9:5 range=[mutating_iuo.swift:9:3 - line:9:18] arg_labels= | |
(dot_syntax_call_expr type='() -> ()' location=mutating_iuo.swift:9:5 range=[mutating_iuo.swift:9:3 - line:9:5] | |
(declref_expr type='(inout Mutating) -> () -> ()' location=mutating_iuo.swift:9:5 range=[mutating_iuo.swift:9:5 - line:9:5] decl=mutating_iuo.(file).Mutating.callFunction()@mutating_iuo.swift:3:17 function_ref=single) | |
(inout_expr implicit type='inout Mutating' location=mutating_iuo.swift:9:3 range=[mutating_iuo.swift:9:3 - line:9:3] | |
(force_value_expr implicit type='@lvalue Mutating' location=mutating_iuo.swift:9:3 range=[mutating_iuo.swift:9:3 - line:9:3] | |
(declref_expr type='@lvalue Mutating?' location=mutating_iuo.swift:9:3 range=[mutating_iuo.swift:9:3 - line:9:3] decl=mutating_iuo.(file).testIUO(f:).f@mutating_iuo.swift:7:14 function_ref=unapplied)))) | |
(tuple_expr type='()' location=mutating_iuo.swift:9:17 range=[mutating_iuo.swift:9:17 - line:9:18])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment