     isSubset fixedVars, (findUnconstrained constraint)
   [deferred, retained] = partition isFixed, impliedConstraints
   quantifiedVars = findFree finalType = substitute ctx.substitution, type
-  impliedVars = concatSets (map findConstrained, retained)...
+  impliedVars = concatSets (map findConstrained, impliedConstraints)...
   validVars = concatSets quantifiedVars, impliedVars
   isAmbiguous = (constraint) ->
     not isSubset validVars, (findUnconstrained constraint)

    log (collapse toHtml compiled.ast)
    if _notEmpty compiled.subs
      log map formatFail, compiled.subs
    if result isnt (got = eval compiled.compiled)
      log "'#{testName}' expected", result, "got", got
    else
      success = yes
  catch e
    logError "Error in test |#{testName}|\n#{teaSource}\n", e
  success

  inferredType = freshInstance ctx, canonicalType
  ctx.extendSubstitution matchType inferredType.type, (substitute ctx.substitution, type).type
  reduceConstraints ctx, inferredType.constraints
  (substitute ctx.substitution, inferredType).constraints

irReference = (name, type, scopeIndex) ->
