From c11371b8ca84e0ce107d34ca76abc9f9b33af6e8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 28 Apr 2023 18:01:29 -0400 Subject: [PATCH] Add test case for https://github.com/apple/swift/issues/56636 / rdar://problem/74794074 --- test/ClangImporter/Inputs/issue-56636.h | 6 ++++++ test/ClangImporter/issue-56636.swift | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/ClangImporter/Inputs/issue-56636.h create mode 100644 test/ClangImporter/issue-56636.swift diff --git a/test/ClangImporter/Inputs/issue-56636.h b/test/ClangImporter/Inputs/issue-56636.h new file mode 100644 index 00000000000..c9ec6125154 --- /dev/null +++ b/test/ClangImporter/Inputs/issue-56636.h @@ -0,0 +1,6 @@ +@import Foundation; + +typedef NS_ENUM( uint32_t, Letter ) { + a, + b, +}; diff --git a/test/ClangImporter/issue-56636.swift b/test/ClangImporter/issue-56636.swift new file mode 100644 index 00000000000..3cd77ebed39 --- /dev/null +++ b/test/ClangImporter/issue-56636.swift @@ -0,0 +1,13 @@ +// RUN: %target-typecheck-verify-swift -import-objc-header %S/Inputs/issue-56636.h + +// REQUIRES: objc_interop + +extension Letter: Strideable { + public func distance(to other: Self) -> RawValue.Stride { + self.rawValue.distance( to: other.rawValue ) + } + + public func advanced(by n: RawValue.Stride) -> Self { + Self( rawValue: self.rawValue.advanced( by: n ) )! + } +}