1// compile 2 3// Copyright 2024 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7package main 8 9type Vector[V any] interface { 10 ReadVector[V] 11} 12 13type ReadVector[V any] interface { 14 Comparisons[ReadVector[V], Vector[V]] 15} 16 17type Comparisons[RV, V any] interface { 18 Diff(RV) V 19} 20 21type VectorImpl[V any] struct{} 22 23func (*VectorImpl[V]) Diff(ReadVector[V]) (_ Vector[V]) { 24 return 25} 26 27func main() { 28 var v1 VectorImpl[int] 29 var v2 Vector[int] 30 _ = v1.Diff(v2) 31} 32