backported to 2.10 - ditched memoization since it uses scala 2.11 macros