Skip to content

Commit edea597

Browse files
authored
api-digester: teach the tool to detect new mutating/throwing functions (#5284)
1 parent 6f19ad7 commit edea597

File tree

7 files changed

+362
-34
lines changed

7 files changed

+362
-34
lines changed

test/api-digester/Inputs/cake1.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public struct S1 {
2+
mutating public func foo1() {}
3+
mutating public func foo2() {}
4+
}

test/api-digester/Outputs/Cake.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
==================================================== Removed Decls ====================================================
3+
4+
==================================================== Moved Decls ====================================================
5+
6+
==================================================== Renamed Decls ====================================================
7+
8+
==================================================== Type Changes ====================================================
9+
10+
==================================================== Decl Attribute changes ====================================================
11+
FuncS1.foo1() is now mutating

test/api-digester/compare-dump.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: rm -rf %t.mod && mkdir -p %t.mod
2+
// RUN: rm -rf %t.sdk && mkdir -p %t.sdk
3+
// RUN: rm -rf %t.module-cache && mkdir -p %t.module-cache
4+
// RUN: %swift -emit-module -o %t.mod/cake.swiftmodule %S/Inputs/cake.swift -parse-as-library
5+
// RUN: %swift -emit-module -o %t.mod/cake1.swiftmodule %S/Inputs/cake1.swift -parse-as-library
6+
// RUN: %api-digester -dump-sdk -module cake -o %t.dump.json -module-cache-path %t.module-cache -sdk %t.sdk -swift-version 3.0 -I %t.mod
7+
// RUN: %api-digester -dump-sdk -module cake1 -o %t.dump1.json -module-cache-path %t.module-cache -sdk %t.sdk -swift-version 3.0 -I %t.mod
8+
// RUN: %api-digester -diagnose-sdk --input-paths %t.dump.json -input-paths %t.dump1.json > %t.result
9+
// RUN: diff -u %S/Outputs/Cake.txt %t.result

test/api-digester/source-stability.swift.expected

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ Func Float80.abs(_:) has been moved to Func abs(_:)
1717
==================================================== Renamed Decls ====================================================
1818

1919
==================================================== Type Changes ====================================================
20-
Func UnsafePointer.withMemoryRebound(to:capacity:_:) has 3rd parameter type change from (UnsafeMutablePointer<T>) throws -> Result to (UnsafePointer<T>) throws -> Result
20+
Func UnsafePointer.withMemoryRebound(to:capacity:_:) has 3rd parameter type change from (UnsafeMutablePointer<T>) throws -> Result to (UnsafePointer<T>) throws -> Result
21+
22+
==================================================== Decl Attribute changes ====================================================

0 commit comments

Comments
 (0)