Function
arrayIsHomogeneous
(array []T, comparer func(a, B T) bool)
Source from the content-addressed store, hash-verified
| 453 | } |
| 454 | |
| 455 | func arrayIsHomogeneous[T any](array []T, comparer func(a, B T) bool) bool { |
| 456 | if len(array) < 2 { |
| 457 | return true |
| 458 | } |
| 459 | first := array[0] |
| 460 | for i := 1; i < len(array); i++ { |
| 461 | target := array[i] |
| 462 | if !comparer(first, target) { |
| 463 | return false |
| 464 | } |
| 465 | } |
| 466 | return true |
| 467 | } |
| 468 | |
| 469 | func typesAreSameReference(a, b *Type) bool { |
| 470 | return a == b || a.symbol != nil && a.symbol == b.symbol || a.alias != nil && a.alias == b.alias |
Tested by
no test coverage detected