       instanceName = ctx.definitionName()
 
       ctx.newScope()
-      freshConstraints = assignMethodTypes ctx, instanceName,
+      freshInstanceType = assignMethodTypes ctx, instanceName,
         classDefinition, instanceType, constraints
+      freshConstraints = freshInstanceType.constraints
       definitions = pairs wheres
       methodsDeclarations = definitionList ctx,
         (prefixWithInstanceName definitions, instanceName)

    prefixedName = instancePrefix instanceName, name
    ctx.declareArity prefixedName, arity
    ctx.assignType prefixedName, quantifiedType
  freshInstanceType.constraints

prefixWithInstanceName = (definitionPairs, instanceName) ->
  for [lhs, rhs] in definitionPairs

    return
  try
    log (collapse toHtml compiled.ast)
    if _notEmpty compiled.subs
      log compiled.subs
    if result isnt (got = eval compiled.compiled)
      log "'#{testName}' expected", result, "got", got
