You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CFile.h:typedefstructPoint3D {
floatx;
floaty;
floatz;
} Point3D;
floatPoint3DGetPointAtIndex(Point3Dpoint, intidx)
__attribute__((swift_name("getter:Point3D.subscript(self:_:)")));
// main.swift:letp = Point3D()
letx = p[0];
// Error: Value of type 'Point3D' has no subscriptslety = Point3DGetPointAtIndex(p, 0)
// 'Point3DGetPointAtIndex' has been replaced by property 'Point3D.subscript'
Apparently, the function is imported as a property named "subscript."
Ah, I figured this would be a regression, but looking at the code I think it was just never implemented. Not quite a starter bug, then, since there's likely to be issues with just doing the "obvious" thing.
Environment
Tested with Xcode 10.2 beta (10P82s).
Additional Detail from JIRA
md5: f75807e11fe8455585f2e10894fdd756
Issue Description:
The ”import as subscript” from SE-0044 Import as member does not work. Example:
Apparently, the function is imported as a property named "subscript."
Related discussion in the Swift forum: Import C functions as subscript methods (follow-up).
The text was updated successfully, but these errors were encountered: