File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -2885,11 +2885,20 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2885
2885
case SILArgumentConvention::Indirect_In_Guaranteed:
2886
2886
return false ;
2887
2887
2888
+ case SILArgumentConvention::Indirect_InoutAliasable:
2889
+ // DISCUSSION: We do not consider inout_aliasable to be "truly mutating"
2890
+ // since today it is just used as a way to mark a captured argument and
2891
+ // not that something truly has mutating semantics. The reason why this
2892
+ // is safe is that the typechecker guarantees that if our value was
2893
+ // immutable, then the use in the closure must be immutable as well.
2894
+ //
2895
+ // TODO: Remove this in favor of using Inout and In_Guaranteed.
2896
+ return false ;
2897
+
2888
2898
case SILArgumentConvention::Indirect_Out:
2889
2899
case SILArgumentConvention::Indirect_In:
2890
2900
case SILArgumentConvention::Indirect_In_Constant:
2891
2901
case SILArgumentConvention::Indirect_Inout:
2892
- case SILArgumentConvention::Indirect_InoutAliasable:
2893
2902
return true ;
2894
2903
2895
2904
case SILArgumentConvention::Direct_Unowned:
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s
2
+
3
+ // This file contains a collection of tests that ensure that the verifier does
4
+ // not fail on specific segments of code. The idea is to ensure that changing
5
+ // the verifier does not cause these to start asserting. When one adds a new
6
+ // check to the verifier, add a test case to make sure normal cases do not
7
+ // crash.
8
+
9
+ sil_stage canonical
10
+
11
+ import Builtin
12
+
13
+ protocol P {
14
+ }
15
+
16
+ sil @generic_user : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
17
+
18
+ sil @open_existential_immutable_access_to_inout_aliasable : $@convention(thin) (@in_guaranteed P) -> () {
19
+ bb0(%0 : $*P):
20
+ %1 = open_existential_addr immutable_access %0 : $*P to $*@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") P
21
+ %2 = function_ref @generic_user : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
22
+ apply %2<@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") P>(%1) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
23
+ %9999 = tuple()
24
+ return %9999 : $()
25
+ }
You can’t perform that action at this time.
0 commit comments