Skip to content

Commit

Permalink
Fix generic functions
Browse files Browse the repository at this point in the history
  • Loading branch information
stanhebben committed Nov 1, 2024
1 parent 9219731 commit 3fea2d4
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import org.openzen.zencode.shared.CodePosition;
import org.openzen.zencode.shared.CompileException;
import org.openzen.zenscript.codemodel.FunctionHeader;
import org.openzen.zenscript.codemodel.HighLevelDefinition;
import org.openzen.zenscript.codemodel.Modifiers;
import org.openzen.zenscript.codemodel.compilation.*;
import org.openzen.zenscript.codemodel.context.CompilingPackage;
import org.openzen.zenscript.codemodel.definition.FunctionDefinition;
import org.openzen.zenscript.codemodel.generic.TypeParameter;
import org.openzen.zenscript.codemodel.identifiers.TypeSymbol;
import org.openzen.zenscript.codemodel.type.BasicTypeID;
import org.openzen.zenscript.lexer.ParseException;
Expand Down Expand Up @@ -94,8 +96,17 @@ public boolean isInner() {

@Override
public void linkTypes() {
if (compiled.header == null)
compiled.setHeader(header.compile(compiler.types()));
if (compiled.header == null) {
FunctionHeader compiledHeader = header.compile(compiler.types());
compiled.setTypeParameters(compiledHeader.typeParameters);

FunctionHeader withoutTypeParameters = new FunctionHeader(
TypeParameter.NONE,
compiledHeader.getReturnType(),
compiledHeader.thrownType,
compiledHeader.parameters);
compiled.setHeader(withoutTypeParameters);
}
}

@Override
Expand Down

0 comments on commit 3fea2d4

Please sign in to comment.