 subToObject = (sub) ->
   ob = {}
   for s, i in sub.vars when s
-    ob["#{i}"] = s
+    ob["#{i + sub.start}"] = s
   ob
 
 

      malformed param, 'A class paramater must occur in at least one method\'s type'
      false)
    return {}
  freshingSub = mapToSubstitution mapMap ((kind) -> ctx.freshTypeVariable kind), kinds
  classParam = (param) ->
    substitute freshingSub, new TypeVariable param, (lookupInMap kinds, param)
  method = ({arity, type, def}) ->

  mapped.start = (subStart sub)
  mapped.fails = sub.fails
  for name in [(subStart sub)...(subLimit sub)] by 1 when v = (inSub sub, name)
    setInSub mapped, name, fn v
  mapped

subIntersection = (subA, subB) ->
