Files
swift-mirror/test/Constraints/rdar158063151.swift
Pavel Yaskevich 9d00c7bd18 [CSApply] Don't attempt operator devirtualization
This appears to only support synthesized conformances because
operators in such cases use different names - `__derived_*`.

These days devirtualization like this is performed as part of
mandatory inlining. And this approach doesn't stack well with
features like `MemberImportVisibility` because there is change
to check whether witness is available or not.
2025-10-10 16:31:11 -07:00

16 lines
600 B
Swift

// RUN: %target-swift-emit-silgen %s | %FileCheck %s
// Make sure that the type-checker selects an `Equatable.==` instead of one from stdlib that takes _OptionalNilComparisonType
struct Value: Equatable, ExpressibleByNilLiteral {
init(nilLiteral: ()) {
}
}
// CHECK-LABEL: sil hidden [ossa] @$s13rdar1580631514test1vyAA5ValueV_tF : $@convention(thin) (Value) -> ()
// CHECK: [[EQUALS_REF:%.*]] = witness_method $Value, #Equatable."==" : <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool
// CHECK-NEXT: apply [[EQUALS_REF]]<Value>({{.*}})
func test(v: Value) {
_ = v == nil
}