 
     # TODO: defer for class declaration if not defined
     ## if not ctx.isClassDefined className    ...
-
-    instance = (new Constrained freshConstraints,
-      (new ClassConstraint instanceType.className, freshInstanceType.type))
-    ## if overlaps ctx, instance
-    ##   malformed 'instance overlaps with another', instance
-    ## else
-    ctx.addInstance instanceName, instance
-
-    # """var #{instanceName} = new #{className}(#{listOf methods});"""
-    (jsVarDeclaration (validIdentifier instanceName),
-      (irDefinition (new Constrained freshConstraints, (tupleOfTypes methodTypes).type),
-        (jsNew className, (join superClassInstances, methods))))
+    if not freshInstanceType
+      jsNoop()
+    else
+      freshConstraints = freshInstanceType.constraints
+      instance = (new Constrained freshConstraints,
+        (new ClassConstraint instanceType.className, freshInstanceType.type))
+      ## if overlaps ctx, instance
+      ##   malformed 'instance overlaps with another', instance
+      ## else
+      ctx.addInstance instanceName, instance
+
+      # """var #{instanceName} = new #{className}(#{listOf methods});"""
+      (jsVarDeclaration (validIdentifier instanceName),
+        (irDefinition (new Constrained freshConstraints, (tupleOfTypes methodTypes).type),
+          (jsNew className, (join superClassInstances, methods))))
 
 # Makes sure methods are typed explicitly and returns the instance constraint
 # with renamed type variables to avoid clashes
-assignMethodTypes = (ctx, instanceName, classDeclaration, instanceType, instanceConstraints) ->
+assignMethodTypes = (ctx, typeExpression, instanceName, classDeclaration, instanceType, instanceConstraints) ->
   # First we must freshen the instance type, to avoid name clashes of type vars
   freshInstanceType = freshInstance ctx,
     (quantifyUnbound ctx,


  # log "mguing", classDeclaration.constraint.types, freshInstanceType.type
  sub = mostGeneralUnifier classDeclaration.constraint.types, freshInstanceType.type
  # log sub

  ctx.bindTypeVariables setToArray (findFree freshInstanceType)
  for name, {arity, type} of values classDeclaration.declarations

    instanceName = ctx.definitionName()

    ctx.newScope()
    freshInstanceType = assignMethodTypes ctx, instanceConstraint, instanceName,
      classDefinition, instanceType, constraints
    definitions = pairs wheres
    methodsDeclarations = definitionList ctx,
      (prefixWithInstanceName definitions, instanceName)
