From 7aad06a4a28a41d2b38ecf0762ab5b84a0505ca0 Mon Sep 17 00:00:00 2001 From: Kory Date: Sun, 6 Mar 2022 01:43:34 +0000 Subject: [PATCH] chore: remove unused types --- .../core/generic/compiletime/Tuple.scala | 19 ------------------- .../core/generic/compiletime/TupleSpec.scala | 14 -------------- 2 files changed, 33 deletions(-) diff --git a/protocol-core/src/main/scala/io/github/kory33/s2mctest/core/generic/compiletime/Tuple.scala b/protocol-core/src/main/scala/io/github/kory33/s2mctest/core/generic/compiletime/Tuple.scala index 7d0e9833..f9a91f73 100644 --- a/protocol-core/src/main/scala/io/github/kory33/s2mctest/core/generic/compiletime/Tuple.scala +++ b/protocol-core/src/main/scala/io/github/kory33/s2mctest/core/generic/compiletime/Tuple.scala @@ -17,18 +17,6 @@ type IncludedInLockedT[T <: Tuple, A] <: Boolean = case ? *: tail => IncludedInLockedT[tail, A] } -/** - * INTERNAL. A type-level boolean indicating if T, mapped with [[Lock]], contains no duplicate - * types. - * - * Takes O(|T|^2) to compute. - */ -type ContainsDistinctLockedT[T <: Tuple] <: Boolean = - T match { - case Lock[head] *: tail => ![IncludedInLockedT[tail, head]] && ContainsDistinctLockedT[tail] - case EmptyTuple => true - } - /** * INTERNAL. Lock tuple [[T]] using [[Lock]] constructor. */ @@ -55,13 +43,6 @@ type Includes[A] = [T <: Tuple] =>> Require[IncludedInT[T, A]] */ type IncludedBy[T <: Tuple] = [A] =>> Require[IncludedInT[T, A]] -/** - * A type-level boolean indicating if [[T]] only contains distinct types. - * - * Takes O(|T|^2) to compute. - */ -type ContainsDistinctT[T <: Tuple] = ContainsDistinctLockedT[LockTuple[T]] - /** * INTERNAL. The index of [[A]] in a tuple [[T]] mapped with [[Lock]]. * diff --git a/protocol-core/src/test/scala/io/github/kory33/s2mctest/core/generic/compiletime/TupleSpec.scala b/protocol-core/src/test/scala/io/github/kory33/s2mctest/core/generic/compiletime/TupleSpec.scala index 89d51dd8..0ca0b553 100644 --- a/protocol-core/src/test/scala/io/github/kory33/s2mctest/core/generic/compiletime/TupleSpec.scala +++ b/protocol-core/src/test/scala/io/github/kory33/s2mctest/core/generic/compiletime/TupleSpec.scala @@ -16,20 +16,6 @@ class TupleSpec extends AnyFlatSpec with should.Matchers { summon[IncludedInT[(Int, String, Double), Float] =:= false] } - "ContainsDistinctT" should "tell whether a tuple contains distinct types" in { - summon[ContainsDistinctT[EmptyTuple] =:= true] - summon[ContainsDistinctT[Int *: EmptyTuple] =:= true] - summon[ContainsDistinctT[(Int, String, Double)] =:= true] - summon[ContainsDistinctT[(Int, 1, 2)] =:= true] - summon[ContainsDistinctT[(Int, Int | String, String)] =:= true] - - summon[ContainsDistinctT[(Int, Int)] =:= false] - summon[ContainsDistinctT[(Int, String, Int)] =:= false] - summon[ContainsDistinctT[(String, Int, Int)] =:= false] - summon[ContainsDistinctT[(Int | String, String, Int, Int | String)] =:= false] - summon[ContainsDistinctT[(true, 1, 2, 3, 1, false)] =:= false] - } - "IndexOfT" should "extract the index of a specific type from a tuple" in { summon[IndexOfT[Int, (String, Int)] =:= 1] summon[IndexOfT[42, (String, Int, 42)] =:= 2]