Skip to content

Basic: Remove VariadicGenerics feature [5.9] #66251

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
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
3 changes: 0 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -5411,9 +5411,6 @@ ERROR(vararg_not_allowed,none,
"variadic parameter cannot appear outside of a function parameter list",
())

ERROR(experimental_type_with_parameter_pack,none,
"generic types with parameter packs are experimental",
())
ERROR(more_than_one_pack_in_type,none,
"generic type cannot declare more than one type pack", ())
ERROR(enum_with_pack,none,
Expand Down
1 change: 0 additions & 1 deletion include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ UPCOMING_FEATURE(ExistentialAny, 335, 6)
UPCOMING_FEATURE(ImportObjcForwardDeclarations, 384, 6)

EXPERIMENTAL_FEATURE(StaticAssert, false)
EXPERIMENTAL_FEATURE(VariadicGenerics, false)
EXPERIMENTAL_FEATURE(NamedOpaqueTypes, false)
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures, false)
EXPERIMENTAL_FEATURE(CodeItemMacros, true)
Expand Down
4 changes: 0 additions & 4 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3204,10 +3204,6 @@ static bool usesFeatureBareSlashRegexLiterals(Decl *decl) {
return false;
}

static bool usesFeatureVariadicGenerics(Decl *decl) {
return false;
}

static bool usesFeatureTupleConformances(Decl *decl) {
return false;
}
Expand Down
4 changes: 0 additions & 4 deletions lib/Sema/TypeCheckDeclPrimary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,6 @@ static void checkGenericParams(GenericContext *ownerCtx) {
// is not enabled.
auto &ctx = decl->getASTContext();
if (gp->isParameterPack() && isGenericType) {
if (!ctx.LangOpts.hasFeature(Feature::VariadicGenerics)) {
decl->diagnose(diag::experimental_type_with_parameter_pack);
}

TypeChecker::checkAvailability(
gp->getSourceRange(),
ownerCtx->getASTContext().getVariadicGenericTypeAvailability(),
Expand Down
4 changes: 1 addition & 3 deletions test/Constraints/one_element_tuple.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

let t1: (_: Int) = (_: 3)

Expand Down
4 changes: 1 addition & 3 deletions test/Constraints/pack-expansion-expressions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature VariadicGenerics

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

func tuplify<each T>(_ t: repeat each T) -> (repeat each T) {
return (repeat each t)
Expand Down
4 changes: 1 addition & 3 deletions test/Constraints/variadic_generic_types.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

// Parsing an UnresolvedSpecializeExpr containing a PackExpansionType
struct G<each T> {}
Expand Down
3 changes: 1 addition & 2 deletions test/DebugInfo/variadic-generics-count.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-ir %s -g -o - \
// RUN: -parse-as-library -module-name a -enable-experimental-feature VariadicGenerics -disable-availability-checking | %FileCheck %s
// RUN: -parse-as-library -module-name a -disable-availability-checking | %FileCheck %s

public func f1<each T>(ts: repeat each T) {
// CHECK: define {{.*}} @"$s1a2f12tsyxxQp_tRvzlF"(%swift.opaque** {{.*}}, i{{32|64}} [[COUNT1_1:.*]], %swift.type** {{.*}})
Expand Down
16 changes: 0 additions & 16 deletions test/Frontend/experimental_feature.swift

This file was deleted.

4 changes: 1 addition & 3 deletions test/Generics/pack-shape-requirements.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-swift-frontend -typecheck -enable-experimental-feature VariadicGenerics %s -debug-generic-signatures -disable-availability-checking 2>&1 | %FileCheck %s

// REQUIRES: asserts
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -disable-availability-checking 2>&1 | %FileCheck %s

protocol P {
associatedtype A
Expand Down
4 changes: 1 addition & 3 deletions test/Generics/variadic_generic_requirements.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

struct Conformance<each T: Equatable> {}

Expand Down
5 changes: 1 addition & 4 deletions test/Generics/variadic_generic_types.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

// Disallowed cases
struct MultiplePack<each T, each U> {} // expected-error {{generic type cannot declare more than one type pack}}
Expand Down
5 changes: 1 addition & 4 deletions test/Generics/variadic_generic_types_availability.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift

// REQUIRES: OS=macosx

Expand Down
5 changes: 1 addition & 4 deletions test/IRGen/pack_archetype_canonicalization.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-feature VariadicGenerics -disable-availability-checking

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking

// This would crash.
public struct G<T> {}
Expand Down
5 changes: 1 addition & 4 deletions test/IRGen/variadic_generic_fulfillment.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-feature VariadicGenerics -disable-availability-checking | %FileCheck %s -DINT=i%target-ptrsize

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking | %FileCheck %s -DINT=i%target-ptrsize

public struct G<T> {}

Expand Down
5 changes: 1 addition & 4 deletions test/IRGen/variadic_generic_fulfillments.sil
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-frontend -emit-ir -primary-file %s -enable-experimental-feature VariadicGenerics | %IRGenFileCheck %s

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-ir -primary-file %s | %IRGenFileCheck %s

import Builtin
import Swift
Expand Down
5 changes: 1 addition & 4 deletions test/IRGen/variadic_generic_types.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-frontend -emit-ir -primary-file %s -enable-experimental-feature VariadicGenerics -disable-availability-checking | %FileCheck %s

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-ir -primary-file %s -disable-availability-checking | %FileCheck %s

// REQUIRES: PTRSIZE=64

Expand Down
5 changes: 1 addition & 4 deletions test/Interpreter/variadic_generic_conformances.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// RUN: %target-run-simple-swift(-enable-experimental-feature VariadicGenerics -Xfrontend -disable-availability-checking)
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking)

// REQUIRES: executable_test

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts

// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime

Expand Down
7 changes: 2 additions & 5 deletions test/Interpreter/variadic_generic_types.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// RUN: %target-run-simple-swift(-enable-experimental-feature VariadicGenerics -Xfrontend -disable-concrete-type-metadata-mangled-name-accessors -Xfrontend -disable-availability-checking)
// RUN: %target-run-simple-swift(-enable-experimental-feature VariadicGenerics -Xfrontend -disable-availability-checking)
// RUN: %target-run-simple-swift(-Xfrontend -disable-concrete-type-metadata-mangled-name-accessors -Xfrontend -disable-availability-checking)
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking)

// REQUIRES: executable_test

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts

// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime

Expand Down
5 changes: 1 addition & 4 deletions test/ModuleInterface/pack_expansion_type.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-module-interface(%t/PackExpansionType.swiftinterface) %s -module-name PackExpansionType -enable-experimental-feature VariadicGenerics -disable-availability-checking
// RUN: %target-swift-emit-module-interface(%t/PackExpansionType.swiftinterface) %s -module-name PackExpansionType -disable-availability-checking
// RUN: %FileCheck %s < %t/PackExpansionType.swiftinterface

// Experimental features require an asserts compiler
// REQUIRES: asserts

// CHECK: #if compiler(>=5.3) && $ParameterPacks
// CHECK-NEXT: public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) where (repeat (each T, each U)) : Any
public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
Expand Down
4 changes: 1 addition & 3 deletions test/Parse/type_parameter_packs.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

protocol P {}

Expand Down
7 changes: 2 additions & 5 deletions test/SIL/Serialization/pack_expansion_type.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module %s -emit-module-path %t/pack_expansion_type.swiftmodule -DLIB -enable-experimental-feature VariadicGenerics
// RUN: %target-swift-frontend -emit-ir %s -I %t -DAPP -module-name main -enable-experimental-feature VariadicGenerics

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-frontend -emit-module %s -emit-module-path %t/pack_expansion_type.swiftmodule -DLIB
// RUN: %target-swift-frontend -emit-ir %s -I %t -DAPP -module-name main

#if LIB

Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/pack_expansion_type.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature VariadicGenerics -disable-availability-checking | %FileCheck %s

// Experimental features require an asserts compiler
// REQUIRES: asserts
// RUN: %target-swift-emit-silgen %s -disable-availability-checking | %FileCheck %s

// CHECK-LABEL: sil [ossa] @$s19pack_expansion_type16variadicFunction1t1ux_q_txQp_txxQp_q_xQptRvzRv_q_Rhzr0_lF : $@convention(thin) <each T, each U where (repeat (each T, each U)) : Any> (@pack_guaranteed Pack{repeat each T}, @pack_guaranteed Pack{repeat each U}) -> @pack_out Pack{repeat (each T, each U)} {
// CHECK: bb0(%0 : $*Pack{repeat (each T, each U)}, %1 : $*Pack{repeat each T}, %2 : $*Pack{repeat each U}):
Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/parameterized_existentials_variadic.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-emit-silgen -module-name parameterized -disable-availability-checking %s -enable-experimental-feature VariadicGenerics | %FileCheck %s

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-emit-silgen -module-name parameterized -disable-availability-checking %s | %FileCheck %s

protocol P<A> {
associatedtype A
Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/variadic-generic-closures.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature VariadicGenerics -disable-availability-checking %s | %FileCheck %s

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-emit-silgen -disable-availability-checking %s | %FileCheck %s

public struct G<T> {}

Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/variadic-generic-tuples.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature VariadicGenerics -disable-availability-checking %s | %FileCheck %s

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-emit-silgen -disable-availability-checking %s | %FileCheck %s

func takeAny(_ arg: Any) {}

Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/variadic-generic-vanishing-tuples.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature VariadicGenerics -disable-availability-checking %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -disable-availability-checking %s | %FileCheck %s

// rdar://107459964
// rdar://107478603

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts

public struct G<Value> {
public let id: Int
}
Expand Down
5 changes: 1 addition & 4 deletions test/SILGen/variadic_generic_types.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-swift-emit-silgen %s -enable-experimental-feature VariadicGenerics -disable-availability-checking

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-swift-emit-silgen %s -disable-availability-checking

struct Variadic<each T> where repeat each T: Equatable {}

Expand Down
7 changes: 2 additions & 5 deletions test/Serialization/pack_expansion_type.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/pack_expansion_type_other.swift -emit-module -emit-module-path %t/pack_expansion_type_other.swiftmodule -enable-experimental-feature VariadicGenerics -disable-availability-checking
// RUN: %target-typecheck-verify-swift -I %t -enable-experimental-feature VariadicGenerics -disable-availability-checking

// Experimental features require an asserts compiler
// REQUIRES: asserts
// RUN: %target-swift-frontend %S/Inputs/pack_expansion_type_other.swift -emit-module -emit-module-path %t/pack_expansion_type_other.swiftmodule -disable-availability-checking
// RUN: %target-typecheck-verify-swift -I %t -disable-availability-checking

import pack_expansion_type_other

Expand Down
5 changes: 1 addition & 4 deletions test/TypeDecoder/variadic_nominal_types.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// RUN: %empty-directory(%t)

// RUN: %target-build-swift -emit-executable %s -g -o %t/variadic_nominal_types -emit-module -enable-experimental-feature VariadicGenerics -Xfrontend -disable-availability-checking
// RUN: %target-build-swift -emit-executable %s -g -o %t/variadic_nominal_types -emit-module -Xfrontend -disable-availability-checking

// RUN: sed -ne '/\/\/ *DEMANGLE-TYPE: /s/\/\/ *DEMANGLE-TYPE: *//p' < %s > %t/input
// RUN: %lldb-moduleimport-test-with-sdk %t/variadic_nominal_types -type-from-mangled=%t/input | %FileCheck %s --check-prefix=CHECK-TYPE

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts

struct Variadic<each T, U> {
struct Inner<each V, W> {}
}
Expand Down
5 changes: 1 addition & 4 deletions test/decl/protocol/conforms/variadic_generic_type.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// Because of -enable-experimental-feature VariadicGenerics
// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

// Generic parameter packs cannot witness associated type requirements
protocol HasAssoc {
Expand Down
4 changes: 1 addition & 3 deletions test/type/pack_expansion.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature VariadicGenerics -disable-availability-checking

// REQUIRES: asserts
// RUN: %target-typecheck-verify-swift -disable-availability-checking

func f1<each T>() -> repeat each T {}
// expected-error@-1 {{pack expansion 'repeat each T' can only appear in a function parameter list, tuple element, or generic argument list}}
Expand Down