Skip to content

Commit 1cec6a4

Browse files
committed
Serialization: Handle precedence groups and operators in ExternallyAccessibleDeclVisitor.
1 parent 061578c commit 1cec6a4

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,8 +3413,6 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
34133413
UNREACHABLE(MacroExpansion);
34143414
UNREACHABLE(GenericTypeParam);
34153415
UNREACHABLE(Param);
3416-
UNREACHABLE(PrecedenceGroup);
3417-
UNREACHABLE(Operator);
34183416

34193417
#undef UNREACHABLE
34203418

@@ -3427,7 +3425,9 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
34273425
#define UNINTERESTING(KIND) \
34283426
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
34293427
UNINTERESTING(IfConfig);
3428+
UNINTERESTING(PrecedenceGroup);
34303429
UNINTERESTING(EnumCase);
3430+
UNINTERESTING(Operator);
34313431

34323432
#undef UNINTERESTING
34333433
};

test/Inputs/lazy_typecheck.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,18 @@ extension PublicStruct {
256256
public static func inactiveMethod() -> DoesNotExist {}
257257
#endif
258258
}
259+
260+
// MARK: - Operators & Precedence Groups
261+
262+
precedencegroup FooPrecedence {
263+
assignment: true
264+
associativity: right
265+
}
266+
267+
infix operator <<<: FooPrecedence
268+
269+
extension PublicStruct {
270+
public static func <<<(lhs: inout Self, rhs: Self) {
271+
lhs = rhs
272+
}
273+
}

test/Inputs/lazy_typecheck_client.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ func testConditionalConformance<T>(_ s: PublicGenericStruct<T>) {
9494
func testTypealiases() {
9595
let _: PublicStruct = PublicStructAlias(x: 1)
9696
}
97+
98+
func testOperators() {
99+
var a: PublicStruct
100+
a <<< PublicStruct(x: 2)
101+
}

test/ModuleInterface/lazy-typecheck.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@
106106
// CHECK: extension lazy_typecheck.PublicStruct {
107107
// CHECK: public static func activeMethod()
108108
// CHECK: }
109+
// CHECK: precedencegroup FooPrecedence {
110+
// CHECK: associativity: right
111+
// CHECK: assignment: true
112+
// CHECK: }
113+
// CHECK: infix operator <<< : FooPrecedence
114+
// CHECK: extension lazy_typecheck.PublicStruct {
115+
// CHECK: public static func <<< (lhs: inout lazy_typecheck.PublicStruct, rhs: lazy_typecheck.PublicStruct)
116+
// CHECK: }
109117
// CHECK: @available(*, unavailable)
110118
// CHECK-NEXT: extension lazy_typecheck.PublicGenericStruct : lazy_typecheck.EmptyPublicProto where T : _ConstraintThatIsNotPartOfTheAPIOfThisLibrary {}
111119
// CHECK: extension lazy_typecheck.PublicStructIndirectlyConformingToPublicProto : lazy_typecheck.PublicProto {}

test/TBD/lazy-typecheck.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ exports:
102102
'_$s14lazy_typecheck12PublicStructV26publicPropertyInferredTypeSSvg',
103103
'_$s14lazy_typecheck12PublicStructV26publicPropertyInferredTypeSSvpMV',
104104
'_$s14lazy_typecheck12PublicStructV26publicPropertyInferredTypeSSvs',
105-
'_$s14lazy_typecheck12PublicStructVMa', '_$s14lazy_typecheck12PublicStructVMn',
106-
'_$s14lazy_typecheck12PublicStructVN', '_$s14lazy_typecheck13PublicWrapperV12wrappedValueACyxGx_tcfC',
105+
'_$s14lazy_typecheck12PublicStructV3llloiyyACz_ACtFZ', '_$s14lazy_typecheck12PublicStructVMa',
106+
'_$s14lazy_typecheck12PublicStructVMn', '_$s14lazy_typecheck12PublicStructVN',
107+
'_$s14lazy_typecheck13PublicWrapperV12wrappedValueACyxGx_tcfC',
107108
'_$s14lazy_typecheck13PublicWrapperV12wrappedValuexvM', '_$s14lazy_typecheck13PublicWrapperV12wrappedValuexvg',
108109
'_$s14lazy_typecheck13PublicWrapperV12wrappedValuexvpMV',
109110
'_$s14lazy_typecheck13PublicWrapperV12wrappedValuexvs', '_$s14lazy_typecheck13PublicWrapperV14projectedValueACyxGvg',

0 commit comments

Comments
 (0)