Buggy code:
public class DefRefAnalyser implements CoreExprAlgebra < DefRefAnalyser > { public static final List < P2 < Identifier , Identifier > > EMPTY_LOCAL_REFS = List . nil ( ) ; public static final List < Identifier > EMPTY_IDENTIFIER_LIST = List . nil ( ) ; public static final DefRefAnalyser EMPTY = new DefRefAnalyser ( ) ; List < Identifier > unresolvedLocalRefs ; List < P2 < Identifier , Identifier > > localRefs ; List < Identifier > localDefs ; List < Identifier > slotRefs ; List < Identifier > slotDefs ; public DefRefAnalyser ( List < Identifier > unresolvedLocalRefs , List < P2 < Identifier , Identifier > > refs , List < Identifier > defs , List < Identifier > slotRefs , List < Identifier > slotDefs ) { } public DefRefAnalyser ( ) { } public static DefRefAnalyser append ( DefRefAnalyser a , DefRefAnalyser b ) { } public static DefRefAnalyser unionList ( List < DefRefAnalyser > maps ) { } @ Override public DefRefAnalyser badExpr ( List < SourceFileRange > ranges , String message , Object ... args ) { } @ Override public DefRefAnalyser objectLiteral ( List < SourceFileRange > ranges , List < P3 < Identifier , Option < Identifier > , DefRefAnalyser > > slots ) { } @ Override public DefRefAnalyser numberLiteral ( List < SourceFileRange > ranges , Number value ) { } @ Override public DefRefAnalyser stringLiteral ( List < SourceFileRange > ranges , String text ) { } @ Override public DefRefAnalyser listLiteral ( List < SourceFileRange > ranges , List < DefRefAnalyser > elements ) { } @ Override public DefRefAnalyser call ( List < SourceFileRange > ranges , DefRefAnalyser function , List < DefRefAnalyser > args ) { } @ Override public DefRefAnalyser extend ( List < SourceFileRange > ranges , DefRefAnalyser base , DefRefAnalyser extension ) { } @ Override public DefRefAnalyser inspect ( List < SourceFileRange > ranges , DefRefAnalyser target ) { } @ Override public DefRefAnalyser identifier ( List < SourceFileRange > ranges , String id ) { } @ Override public DefRefAnalyser let ( List < SourceFileRange > ranges , List < P2 < Identifier , DefRefAnalyser > > bindings , DefRefAnalyser body ) { } private DefRefAnalyser defs ( List < Identifier > newNames ) { TreeMap < String , Identifier > bindings = TreeMap . treeMap ( stringOrd , newNames . map ( ( name ) -> P . p ( name . id , name ) ) ) ; final List < Either < Identifier , P2 < Identifier , Identifier > > > boundVars = this . unresolvedLocalRefs . map ( ( ref ) -> bindings . get ( ref . id ) . map ( ( def ) -> P . p ( ref , def ) ) . toEither ( ref ) ) ; List < P2 < Identifier , Identifier > > newRefs = this . localRefs . append ( Either . rights ( boundVars ) ) ; List < Identifier > newFreeVars = Either . lefts ( boundVars ) ; List < Identifier > newDefs = this . localDefs . append ( newNames ) ; <START_BUG> return new DefRefAnalyser ( newFreeVars , newRefs , newDefs , this . slotRefs , this . slotRefs ) ; <END_BUG> } @ Override public DefRefAnalyser functionLiteral ( List < SourceFileRange > ranges , List < Identifier > args , DefRefAnalyser body , Option < Identifier > sourceObjectBinding ) { } @ Override public DefRefAnalyser baseFunctionRef ( List < SourceFileRange > sourceFileRanges , Identifier name ) { } @ Override public DefRefAnalyser slotReference ( List < SourceFileRange > ranges , DefRefAnalyser object , Identifier slotName , boolean base ) { } public List < Identifier > slotsReferencedButNeverDefined ( ) { } public List < BadExpr > getProblems ( ) { } protected BadCoreExpr slotDefNotMatchingAnyRef ( Identifier name ) { } protected BadCoreExpr unboundIdentifier ( Identifier name ) { } public static List < BadExpr > problems ( CoreExpr ast ) { } public static List < BadExpr > problems ( CoreExpr ast , List < P2 < Identifier , CoreExpr > > bindings ) { } }

Fix:
return new DefRefAnalyser ( newFreeVars , newRefs , newDefs , this . slotRefs , this . slotDefs ) ;