Files
swift-mirror/test/embedded/generic-specialization.swift
Erik Eckstein 6df033b298 SIL: only use canonical substitution maps in SIL
* When constructing instructions which have substitution maps: initialize those with the canonical SubstitutionMap
* Also initialize SILFunction::ForwardingSubMap with the canonical one

Non-canonical substitution maps may prevent generic specializations.
This fixes a problem in Embedded Swift where an error is given because a function cannot be specialized, although it should.

https://github.com/swiftlang/swift/issues/83895
rdar://159065157
2025-08-29 22:31:04 +02:00

14 lines
495 B
Swift

// RUN: %target-run-simple-swift( -enable-experimental-feature Embedded -wmo -runtime-compatibility-version none) | %FileCheck %s
// RUN: %target-run-simple-swift(-O -enable-experimental-feature Embedded -wmo -runtime-compatibility-version none) | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: swift_feature_Embedded
func f<V>(_ a: [V]) -> [String] {
return a.indices.map { String($0 /* as Int*/) } // adding `as Int` makes it compile
}
// CHECK: 0
print(f(["A"]).joined())