/**
 * 
 */
package org.aikodi.chameleon.oo.type.generics;

import org.aikodi.chameleon.core.lookup.LookupException;
import org.aikodi.chameleon.oo.type.Type;

public class LazyFormalAlias extends TypeVariable {

	public LazyFormalAlias(String name, FormalTypeParameter param) {
		super(name,null,param);
	}
	
	@Override
   public Type aliasedType() {
		try {
			return parameter().upperBound();
		} catch (LookupException e) {
			throw new Error("LookupException while looking for aliasedType of a lazy alias",e);
		}
	}
	
	@Override
	public TypeVariable cloneSelf() {
	  return new LazyFormalAlias(name(), parameter());
	}

}

/**
 * 
 */
package org.aikodi.chameleon.oo.type.generics;

import org.aikodi.chameleon.core.lookup.LookupException;
import org.aikodi.chameleon.oo.type.Type;

public class LazyFormalAlias extends TypeVariable {

	public LazyFormalAlias(String name, FormalTypeParameter param) {
		super(name,null,param);
	}
	
	@Override
   public Type aliasedType() {
		try {
			return parameter().actualUpperBound();
		} catch (LookupException e) {
			throw new Error("LookupException while looking for aliasedType of a lazy alias",e);
		}
	}
	
	@Override
	public TypeVariable cloneSelf() {
	  return new LazyFormalAlias(name(), parameter());
	}

}

return the actual upper bound instead of the worst bound