From 9ec4de1160ceaced881e10a8cade406e99257cab Mon Sep 17 00:00:00 2001 From: Jim Powers Date: Thu, 26 Mar 2015 13:38:05 -0400 Subject: [PATCH] Added filter to remove duplicate elements when merging --- src/main/scala/TMap.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/TMap.scala b/src/main/scala/TMap.scala index f0e40b2..ae750be 100644 --- a/src/main/scala/TMap.scala +++ b/src/main/scala/TMap.scala @@ -16,8 +16,8 @@ class TMap[+T] private(private val values: List[(Type, Any)]) { Concatenate two TMaps. Elements of the left one override */ - def ++[S](other: TMap[S]) - = new TMap[T with S](other.values ++ values) + def ++[S](other: TMap[S])(implicit tt: TypeTag[S]) + = new TMap[T with S](other.values ++ values.filterNot(_._1 <:< tt.tpe)) override def toString = "TMap("+values.toString+")" }