Skip to content

Commit 71a5d9b

Browse files
committed
AST: Re-baseline ValueGenericsNameLookup feature.
1 parent 1d9e085 commit 71a5d9b

File tree

4 files changed

+2
-57
lines changed

4 files changed

+2
-57
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ LANGUAGE_FEATURE(RawIdentifiers, 451, "Raw identifiers")
261261
LANGUAGE_FEATURE(SendableCompletionHandlers, 463, "Objective-C completion handler parameters are imported as @Sendable")
262262
LANGUAGE_FEATURE(AsyncExecutionBehaviorAttributes, 0, "@concurrent and nonisolated(nonsending)")
263263
LANGUAGE_FEATURE(IsolatedConformances, 407, "Global-actor isolated conformances")
264-
LANGUAGE_FEATURE(ValueGenericsNameLookup, 452, "Value generics appearing as static members for namelookup")
264+
BASELINE_LANGUAGE_FEATURE(ValueGenericsNameLookup, 452, "Value generics appearing as static members for namelookup")
265265
LANGUAGE_FEATURE(GeneralizedIsSameMetaTypeBuiltin, 465, "Builtin.is_same_metatype with support for noncopyable/nonescapable types")
266266
SUPPRESSIBLE_LANGUAGE_FEATURE(ABIAttributeSE0479, 479, "@abi attribute on functions, initializers, properties, and subscripts")
267267
LANGUAGE_FEATURE(AlwaysInheritActorContext, 472, "@_inheritActorContext(always)")

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -400,54 +400,6 @@ bool swift::usesFeatureIsolatedDeinit(const Decl *decl) {
400400
}
401401
}
402402

403-
class UsesTypeValueExpr : public ASTWalker {
404-
public:
405-
bool used = false;
406-
407-
PreWalkResult<Expr *> walkToExprPre(Expr *expr) override {
408-
if (isa<TypeValueExpr>(expr)) {
409-
used = true;
410-
return Action::Stop();
411-
}
412-
413-
return Action::Continue(expr);
414-
}
415-
};
416-
417-
static bool usesFeatureValueGenericsNameLookup(Decl *decl) {
418-
// Be conservative and mark any function that has a TypeValueExpr in its body
419-
// as having used this feature. It's a little difficult to fine grain this
420-
// check because the following:
421-
//
422-
// func a() -> Int {
423-
// A<123>.n
424-
// }
425-
//
426-
// Would appear to have the same expression as something like:
427-
//
428-
// extension A where n == 123 {
429-
// func b() -> Int {
430-
// n
431-
// }
432-
// }
433-
434-
auto fn = dyn_cast<AbstractFunctionDecl>(decl);
435-
436-
if (!fn)
437-
return false;
438-
439-
auto body = fn->getMacroExpandedBody();
440-
441-
if (!body)
442-
return false;
443-
444-
UsesTypeValueExpr utve;
445-
446-
body->walk(utve);
447-
448-
return utve.used;
449-
}
450-
451403
static bool usesFeatureCoroutineAccessors(Decl *decl) {
452404
auto accessorDeclUsesFeatureCoroutineAccessors = [](AccessorDecl *accessor) {
453405
return requiresFeatureCoroutineAccessors(accessor->getAccessorKind());

stdlib/public/core/InlineArray.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,11 @@ extension InlineArray where Element: Copyable {
319319
@available(SwiftStdlib 6.2, *)
320320
@_alwaysEmitIntoClient
321321
public init(repeating value: Element) {
322-
#if $ValueGenericsNameLookup
323322
_storage = Builtin.emplace {
324323
let buffer = unsafe Self._initializationBuffer(start: $0)
325324

326325
unsafe buffer.initialize(repeating: value)
327326
}
328-
#else
329-
fatalError()
330-
#endif
331327
}
332328
}
333329

test/ModuleInterface/value_generics.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name ValueGeneric -disable-availability-checking
33
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name ValueGeneric -disable-availability-checking
4-
// RUN: %FileCheck %s < %t.swiftinterface
4+
// RUN: %FileCheck --implicit-check-not=ValueGenericsNameLookup %s < %t.swiftinterface
55

66
// CHECK: public struct Slab<Element, let N : Swift.Int>
77
public struct Slab<Element, let N: Int> {
@@ -27,21 +27,18 @@ public func usesConcreteSlab(_: Slab<Int, 2>) {}
2727
// CHECK: public func usesNegativeSlab(_: ValueGeneric.Slab<Swift.String, -10>)
2828
public func usesNegativeSlab(_: Slab<String, -10>) {}
2929

30-
// CHECK: $ValueGenericsNameLookup
3130
@inlinable
3231
public func test() -> Int {
3332
// CHECK: Slab<Int, 123>.N
3433
Slab<Int, 123>.N
3534
}
3635

37-
// CHECK: $ValueGenericsNameLookup
3836
@inlinable
3937
public func test2() -> Int {
4038
// CHECK: type(of: Slab<Int, 123>()).N
4139
type(of: Slab<Int, 123>()).N
4240
}
4341

44-
// CHECK: $ValueGenericsNameLookup
4542
@inlinable
4643
public func test3() {
4744
{

0 commit comments

Comments
 (0)