Buggy code:
public class TypeInfererImpl implements TypeInferer { private final ArgumentTypeInferer argumentTypeInferer ; private final BlockTypeChecker blockTypeChecker ; private final TypeLookup typeLookup ; private final NodeLocations nodeLocations ; @ Inject public TypeInfererImpl ( ArgumentTypeInferer argumentTypeInferer , BlockTypeChecker blockTypeChecker , TypeLookup typeLookup , NodeLocations nodeLocations ) { } public TypeResult < ValueInfo > inferValueInfo ( ExpressionNode expression , StaticContext context ) { } public TypeResult < Type > inferType ( ExpressionNode expression , StaticContext context ) { } private TypeResult < ValueInfo > inferType ( final ShortLambdaExpressionNode lambdaExpression , StaticContext context ) { } public TypeResult < ValueInfo > inferFunctionTypeAndTypeCheckBody ( final FunctionWithBodyNode function , final StaticContext context ) { } public TypeResult < ValueInfo > inferFunctionType ( final FunctionWithBodyNode function , final StaticContext context ) { } public Function < ValueInfo , TypeResult < ValueInfo > > typeCheckBody ( final FunctionWithBodyNode function , final StaticContext context ) { } private TypeResult < ValueInfo > inferCallType ( final CallNode expression , final StaticContext context ) { } private TypeResult < ValueInfo > inferMemberAccessType ( final MemberAccessNode memberAccess , final StaticContext context ) { } private TypeResult < ValueInfo > inferTypeApplicationType ( final TypeApplicationNode typeApplication , final StaticContext context ) { return inferType ( typeApplication . getBaseValue ( ) , context ) . ifValueThen ( new Function < Type , TypeResult < Type > > ( ) { @ Override public TypeResult < Type > apply ( Type baseType ) { List < Type > parameterTypes = Lists . transform ( typeApplication . getParameters ( ) , toParameterType ( context ) ) ; if ( baseType instanceof ParameterisedFunctionType ) { ParameterisedFunctionType functionType = ( ( ParameterisedFunctionType ) ( baseType ) ) ; ImmutableMap . Builder < FormalTypeParameter , Type > replacements = ImmutableMap . builder ( ) ; for ( int i = 0 ; i < ( functionType . getTypeParameters ( ) . size ( ) ) ; i += 1 ) { replacements . put ( functionType . getTypeParameters ( ) . get ( i ) , parameterTypes . get ( i ) ) ; } <START_BUG> return TypeResult . success ( new TypeReplacer ( ) . replaceTypes ( functionType , replacements . build ( ) ) ) ; <END_BUG> } else if ( baseType instanceof ParameterisedType ) { return TypeResult . success ( ( ( Type ) ( CoreTypes . classOf ( new org . zwobble . shed . compiler . types . TypeApplication ( ( ( ParameterisedType ) ( baseType ) ) , parameterTypes ) ) ) ) ) ; } else { throw new RuntimeException ( ( ( ( "Don't<seq2seq4repair_space>know<seq2seq4repair_space>how<seq2seq4repair_space>to<seq2seq4repair_space>apply<seq2seq4repair_space>types<seq2seq4repair_space>" + parameterTypes ) + "<seq2seq4repair_space>to<seq2seq4repair_space>" ) + baseType ) ) ; } } } ) . ifValueThen ( TypeInfererImpl . toValueInfo ( ) ) ; } private TypeResult < ValueInfo > inferAssignmentType ( AssignmentExpressionNode expression , StaticContext context ) { } private static Function < ValueInfo , TypeResult < ValueInfo > > checkIsAssignable ( final SourceRange location ) { } private Function < ExpressionNode , Type > toParameterType ( final StaticContext context ) { } private static Function < List < Type > , TypeResult < Type > > buildFunctionType ( final Type returnType ) { } private static Function < Type , TypeResult < ValueInfo > > toValueInfo ( ) { } private TypeResult < StatementTypeCheckResult > typeCheckBlock ( BlockNode block , NodeLocations nodeLocations , StaticContext context , Option < Type > returnType ) { } }

Fix:
return TypeResult . success ( new TypeReplacer ( ) . replaceTypes ( functionType . getBaseFunctionType ( ) , replacements . build ( ) ) ) ;