Skip to content

Add OGTypeNominalDescriptor API #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
AGTypeKind AGTypeGetKind(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.kind(self:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
const void * AGTypeNominalDescriptor(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.nominalDescriptor(self:));

AG_EXTERN_C_END

#endif /* AGTypeID_h */
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
AGTypeKind AGTypeGetKind(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.kind(self:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
const void * AGTypeNominalDescriptor(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.nominalDescriptor(self:));

AG_EXTERN_C_END

#endif /* AGTypeID_h */
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
AGTypeKind AGTypeGetKind(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.kind(self:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
const void * AGTypeNominalDescriptor(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.nominalDescriptor(self:));

AG_EXTERN_C_END

#endif /* AGTypeID_h */
4 changes: 4 additions & 0 deletions AG/Sources/Headers/AGTypeID.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ AG_EXPORT
AG_REFINED_FOR_SWIFT
AGTypeKind AGTypeGetKind(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.kind(self:));

AG_EXPORT
AG_REFINED_FOR_SWIFT
const void * AGTypeNominalDescriptor(AGTypeID typeID) AG_SWIFT_NAME(getter:AGTypeID.nominalDescriptor(self:));

AG_EXTERN_C_END

#endif /* AGTypeID_h */
4 changes: 4 additions & 0 deletions Sources/_OpenGraph/Runtime/OGTypeID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
// FIXME: Unimplemented
return OGTypeKindNone;
}

const void * OGTypeNominalDescriptor(OGTypeID typeID) {
return nullptr;

Check warning on line 16 in Sources/_OpenGraph/Runtime/OGTypeID.cpp

View check run for this annotation

Codecov / codecov/patch

Sources/_OpenGraph/Runtime/OGTypeID.cpp#L15-L16

Added lines #L15 - L16 were not covered by tests
}
4 changes: 4 additions & 0 deletions Sources/_OpenGraph/Runtime/OGTypeID.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ OG_EXPORT
OG_REFINED_FOR_SWIFT
OGTypeKind OGTypeGetKind(OGTypeID typeID) OG_SWIFT_NAME(getter:OGTypeID.kind(self:));

OG_EXPORT
OG_REFINED_FOR_SWIFT
const void * OGTypeNominalDescriptor(OGTypeID typeID) OG_SWIFT_NAME(getter:OGTypeID.nominalDescriptor(self:));

OG_EXTERN_C_END

#endif /* OGTypeID_h */
19 changes: 19 additions & 0 deletions Tests/OpenGraphCompatibilityTests/Runtime/OGTypeIDTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// OGTypeIDTests.swift
// OpenGraphCompatibilityTests

import Testing

@Suite(.disabled(if: !compatibilityTestEnabled, "OGTypeID is not implemented"))
struct OGTypeIDTests {

@Test
func descriptor() throws {
let n1 = try #require(OGTypeID(Int.self).nominalDescriptor)
let n2 = try #require(OGTypeID(String.self).nominalDescriptor)
let n3 = try #require(OGTypeID(Int.self).nominalDescriptor)

#expect(n1 != n2)
#expect(n1 == n3)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//
// TupleTypeTests.swift
//
//
//
// OpenGraphCompatibilityTests

import Testing

Expand Down
Loading