swift icon indicating copy to clipboard operation
swift copied to clipboard

[Sema/SILGen/IRGen/StdLib] Implement metatype keypaths

Open amritpan opened this issue 1 year ago • 7 comments

This is the implementation for SE-0438: Metatype Keypaths which extends keypath usage to include references to static properties, eg. metatype keypaths:

struct Bee {
  static let name = "honeybee"
}

let kp = \Bee.Type.name

amritpan avatar Apr 25 '24 02:04 amritpan

@swift-ci please build toolchain macOS platform

xedin avatar May 17 '24 21:05 xedin

@swift-ci please build toolchain Linux platform

xedin avatar May 28 '24 20:05 xedin

@swift-ci please build toolchain macOS platform

amritpan avatar Jul 29 '24 23:07 amritpan

@swift-ci please build toolchain macOS platform

amritpan avatar Sep 21 '24 20:09 amritpan

@swift-ci please build toolchain Linux platform

amritpan avatar Sep 21 '24 20:09 amritpan

@xedin This is ready for final review before I merge!

amritpan avatar Sep 21 '24 21:09 amritpan

Great, I will take a look on Monday!

xedin avatar Sep 21 '24 22:09 xedin

@swift-ci please build toolchain macOS platform

amritpan avatar Sep 24 '24 07:09 amritpan

@swift-ci please build toolchain Linux platform

amritpan avatar Sep 24 '24 07:09 amritpan

@swift-ci please test

xedin avatar Sep 24 '24 07:09 xedin

@swift-ci please test

xedin avatar Sep 24 '24 15:09 xedin

@swift-ci please test

xedin avatar Sep 24 '24 20:09 xedin

@swift-ci please test

amritpan avatar Sep 26 '24 03:09 amritpan

@swift-ci please test

amritpan avatar Sep 27 '24 05:09 amritpan

Glad to see this long-awaited feature is in progress :-)

groue avatar Sep 27 '24 10:09 groue

@swift-ci please test

amritpan avatar Sep 27 '24 18:09 amritpan

@swift-ci please smoke test

amritpan avatar Sep 28 '24 05:09 amritpan

It looks like some of the tests now need to be marked REQUIRES: asserts, because they currently fail in a noassert build:

<unknown>:0: error: experimental feature 'KeyPathWithStaticMembers' cannot be enabled in production compiler

Instead, it would be better to split off the tests for the new feature into their own file(s).

slavapestov avatar Sep 30 '24 03:09 slavapestov

@amritpan could you please all the tests where you added the flat? Looks like we didn’t get all of them

xedin avatar Sep 30 '24 05:09 xedin

We are seeing swift macOS toolchain bot failing most likely related to this PR.

FAIL: Swift(macosx-x86_64) :: abi/macOS/x86_64/stdlib.swift (9366 of 18223)
******************** TEST 'Swift(macosx-x86_64) :: abi/macOS/x86_64/stdlib.swift' FAILED ********************
Script:
--
: 'RUN: at line 1';   rm -rf "/Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp" && mkdir -p "/Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp"
: 'RUN: at line 2';   /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/llvm-macosx-x86_64/bin/llvm-nm -g --defined-only -f just-symbols /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/lib/swift/macosx/x86_64/libswiftCore.dylib > /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp/symbols
: 'RUN: at line 3';   /Applications/Xcode-beta.app/Contents/Developer/usr/bin/python3 /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/utils/swift-abi-symbol-checker.py /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/test/abi/macOS/x86_64/stdlib.swift /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp/symbols
: 'RUN: at line 4';   diff -u /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/test/abi/macOS/x86_64/../../Inputs/macOS/x86_64/stdlib/baseline /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp/symbols
--
Exit Code: 1

Command Output (stdout):
--
--- /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/test/abi/macOS/x86_64/../../Inputs/macOS/x86_64/stdlib/baseline	2024-10-02 03:37:11
+++ /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/build/buildbot_osx/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/stdlib.swift.tmp/symbols	2024-10-02 06:19:33
@@ -1,4 +1,8 @@
 $ld$previous$@rpath/libswiftCore.dylib$$1$10.9$10.14.4$$
+<MISSING ADDITION> _$ss24_RuntimeFunctionCountersV03numabC0SivpZMV
+<MISSING ADDITION> _$ss24_RuntimeFunctionCountersV07runtimeB11NameToIndexSDySSSiGvpZMV
+<MISSING ADDITION> _$ss24_RuntimeFunctionCountersV07runtimeB5NamesSaySSGvpZMV
+<MISSING ADDITION> _$ss24_RuntimeFunctionCountersV07runtimebC7OffsetsSPys6UInt16VGvpZMV
 _$s11MaskStorages4SIMDPTl
 _$s11RawExponentSBTl
 _$s11SubSequenceSlTl

--

********************

shahmishal avatar Oct 02 '24 06:10 shahmishal

@amritpan could you please take a look?

xedin avatar Oct 02 '24 08:10 xedin

@shahmishal I've opened this PR to resolve this. Thank you!

amritpan avatar Oct 02 '24 17:10 amritpan

@slavapestov Created this PR: https://github.com/swiftlang/swift/pull/76824

shahmishal avatar Oct 02 '24 17:10 shahmishal

@shahmishal It seems that the abi test failures are persisting? I've reopened #76826.

amritpan avatar Oct 04 '24 08:10 amritpan