text stringlengths 171 29.4k |
|---|
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
x
// Test Case
[/INST]
public void testRequiredOptions(){
PatternBuilder builder = new PatternBuilder();
builder.withPattern("hc!<");
Option option = builder.create();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected StringBuffer renderWrappedText(StringBuffer sb, int width,
int nextLineTabStop, String text)
{
int pos = f... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected void checkRequiredOptions()
throws MissingOptionException
{
// if there are required options that have not been
// processsed
if... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void removeUnreferencedFunctionArgs(Scope fnScope) {
// Notice that removing unreferenced function args breaks
// Function.prototype.length. In advanced mode, w... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
static boolean mayBeString(Node n, boolean recurse) {
if (recurse) {
return allResultsMatch(n, MAY_BE_STRING_PREDICATE);
} else {
return mayBeStringHelper(n... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
if (n.getType() == Token.FUNCTION) {
// Don't traverse functions that are constructors or have ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean shouldReportThis(Node n, Node parent) {
if (assignLhsChild != null) {
// Always report a THIS on the left side of an assign.
return true;
}
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected CompilerOptions createOptions() {
CompilerOptions options = new CompilerOptions();
options.setCodingConvention(new ClosureCodingConvention());
Compilation... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void process(Node externs, Node root) {
NodeTraversal.traverse(compiler, root, this);
if (MAKE_LOCAL_NAMES_UNIQUE) {
MakeDeclaredNamesUnique renamer = new ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override public ObjectType getTypeWithProperty(String field, JSType type) {
if (!(type instanceof ObjectType)) {
if (type.autoboxesTo() != null) {
ty... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private static boolean mayThrowException(Node n) {
switch (n.getType()) {
case Token.CALL:
case Token.GETPROP:
case Token.GETELEM:
case Token.THROW:... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
JSType meet(JSType that) {
UnionTypeBuilder builder = new UnionTypeBuilder(registry);
for (JSType alternate : alternates) {
if (alternate.isSubtype(that)) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
void tryFoldStringJoin(NodeTraversal t, Node n, Node left, Node right,
Node parent) {
if (!NodeUtil.isGetProp(left) || !NodeUtil.isImmutableValue(r... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean recordBlockDescription(String description) {
if (parseDocumentation) {
populated = true;
}
return currentInfo.documentBlock(description);
}
//... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
boolean canCollapseUnannotatedChildNames() {
if (type == Type.OTHER || globalSets != 1 || localSets != 0) {
return false;
}
// Don't try to collaps... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected CompilerOptions createOptions() {
CompilerOptions options = new CompilerOptions();
if (flags.processJqueryPrimitives) {
options.setCodingConvention(new ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void exitScope(NodeTraversal t) {
if (t.getScopeDepth() > 2) {
findNamespaceShadows(t);
}
if (t.getScopeDepth() == 2) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void findAliases(NodeTraversal t) {
Scope scope = t.getScope();
for (Var v : scope.getVarIterable()) {
Node n = v.getNode();
Node parent =... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (isCallToScopeMethod(n)) {
validateScopeCall(t, n, n.getParent());
}
if ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Node parseContextTypeExpression(JsDocToken token) {
return parseTypeName(token);
}
// Test Case
[/INST]
public void testStructuralConstructor2() throws E... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void visitGetProp(NodeTraversal t, Node n, Node parent) {
// obj.prop or obj.method()
// Lots of types can appear on the left, a call to a void function can
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void findAliases(NodeTraversal t) {
Scope scope = t.getScope();
for (Var v : scope.getVarIterable()) {
Node n = v.getNode();
Node parent =... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Node getChildBefore(Node child) {
if (child == first) {
return null;
}
Node n = first;
while (n.next != child) {
n = n.next;
if (n == ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected JSType caseTopType(JSType topType) {
return topType;
}
// Test Case
[/INST]
public void testGoogIsArray2() throws Exception {
testClosu... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean inferTemplatedTypesForCall(
Node n, FunctionType fnType) {
final ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap()
.getTemplateKe... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void processRequireCall(NodeTraversal t, Node n, Node parent) {
Node left = n.getFirstChild();
Node arg = left.getNext();
if (verifyLastArgumentIsString(t, ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void recordAssignment(NodeTraversal t, Node n, Node recordNode) {
Node nameNode = n.getFirstChild();
Node parent = n.getParent();
NameInformation ns... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private CanInlineResult canInlineReferenceDirectly(
Node callNode, Node fnNode) {
if (!isDirectCallNodeReplacementPossible(fnNode)) {
return CanInlineResult.NO;... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private CanInlineResult canInlineReferenceDirectly(
Node callNode, Node fnNode) {
if (!isDirectCallNodeReplacementPossible(fnNode)) {
return CanInlineResult.NO;... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
String getReadableJSTypeName(Node n, boolean dereference) {
// The best type name is the actual type name.
// If we're analyzing a GETPROP, the property may be inheri... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void handleObjectLit(NodeTraversal t, Node n) {
for (Node child = n.getFirstChild();
child != null;
child = child.getNext()) {
// Ma... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void collect(JSModule module, Scope scope, Node n) {
Node parent = n.getParent();
String name;
boolean isSet = false;
Name.Type type = Name.Ty... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean hasExceptionHandler(Node cfgNode) {
return false;
}
// Test Case
[/INST]
public void testIssue794b() {
noInline(
"var x = 1; " +
"t... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
boolean isAssignedOnceInLifetime() {
Reference ref = getOneAndOnlyAssignment();
if (ref == null) {
return false;
}
// Make sure this assignme... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void inlineNonConstants(
Var v, ReferenceCollection referenceInfo,
boolean maybeModifiedArguments) {
int refCount = referenceInfo.references.siz... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void handleBlockComment(Comment comment) {
if (comment.getValue().indexOf("/* @") != -1 || comment.getValue().indexOf("\n * @") != -1) {
errorReporter.warning... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
void add(Node n, Context context) {
if (!cc.continueProcessing()) {
return;
}
int type = n.getType();
String opstr = NodeUtil.opToStr(type);
int chil... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean isSafeReplacement(Node node, Node replacement) {
// No checks are needed for simple names.
if (node.isName()) {
return true;
}
Preconditio... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void visitNew(NodeTraversal t, Node n) {
Node constructor = n.getFirstChild();
JSType type = getJSType(constructor).restrictByNotNullOrUndefined();
if (type... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
void tryMinimizeExits(Node n, int exitType, String labelName) {
// Just an 'exit'.
if (matchingExitNode(n, exitType, labelName)) {
NodeUtil.removeChild(n.getPare... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@SuppressWarnings("fallthrough")
private void tryRemoveUnconditionalBranching(Node n) {
/*
* For each unconditional branching control flow node, check to see... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
static boolean isSimpleNumber(String s) {
int len = s.length();
for (int index = 0; index < len; index++) {
char c = s.charAt(index);
if (c < '0' || c > '9'... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void annotateCalls(Node n) {
Preconditions.checkState(n.isCall());
// Keep track of of the "this" context of a call. A call without an
// explicit... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void traverse(Node node) {
// The goal here is to avoid retraversing
// the entire AST to catch newly created opportunities.
// So we track whether a "unit ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void inlineAliases(GlobalNamespace namespace) {
// Invariant: All the names in the worklist meet condition (a).
Deque<Name> workList = new ArrayDeque<Name>(name... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static boolean isJSIdentifier(String s) {
int length = s.length();
if (length == 0 ||
!Character.isJavaIdentifierStart(s.charAt(0))) {
r... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Node tryMinimizeIf(Node n) {
Node parent = n.getParent();
Node cond = n.getFirstChild();
/* If the condition is a literal, we'll let other
* optimiz... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private String getRemainingJSDocLine() {
String result = stream.getRemainingJSDocLine();
return result;
}
// Test Case
[/INST]
public void testTextExtents() {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void process(Node externs, Node root) {
NodeTraversal.traverse(compiler, externs, new ProcessExterns());
NodeTraversal.traverse(compiler, root, new ProcessProper... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean isIndependentOf(Property prop) {
if (typesRelatedToSet.intersects(prop.typesSet)) {
return false;
}
return !getRelated(prop.type).int... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void addNode(Property prop) {
typesInSet.or(prop.typesSet);
typesRelatedToSet.or(getRelated(prop.type));
}
// Test Case
[/INST]
public void testImpl... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private FunctionType findOverriddenFunction(
ObjectType ownerType, String propName) {
// First, check to see if the property is implemented
// on a superc... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void addNonUnionType(JSType newType) {
if (skipAmbiguating || isInvalidatingType(newType)) {
skipAmbiguating = true;
return;
}
if (... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void replaceReferencesToThis(Node node, String name) {
if (NodeUtil.isFunction(node)) {
return;
}
for (Node child : node.children()) {
if (Node... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
boolean defineProperty(String name, JSType type,
boolean inferred, boolean inExterns) {
if ("prototype".equals(name)) {
ObjectType objType = type.to... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void addPossibleSignature(String name, Node node, NodeTraversal t) {
boolean signatureAdded = false;
if (node.getType() == Token.FUNCTION) {
// The node w... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (n.getType() != Token.NAME) {
return;
}
String name = n.getString();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void process(Node externs, Node root) {
NodeTraversal.traverse(compiler, root,
new NormalizeStatements(compiler, assertOnChange));
removeDupl... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private static String getOrginalNameInternal(String name, int index) {
return name.substring(0, index);
}
// Test Case
[/INST]
public void testOnlyInversion3() {... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void visit(NodeTraversal t, Node node, Node parent) {
if (node.getType() == Token.NAME) {
String oldName = node.getString();
if (co... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void addDeclaredName(String name) {
if (global) {
reserveName(name);
} else {
// It hasn't been declared locally yet,... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void addDeclaredName(String name) {
if (!declarations.containsKey(name)) {
declarations.put(name, getUniqueName(name));
}
}
// T... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
x
// Test Case
[/INST]
public void testOnlyInversion3() {
invert = true;
test(
"function x1() {" +
" var a$$1;" +
" function x2() {" +
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public FlowScope getPreciserScopeKnowingConditionOutcome(Node condition,
FlowScope blindScope, boolean outcome) {
if (condition.getType() == CALL && condi... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private FlowScope traverseName(Node n, FlowScope scope) {
String varName = n.getString();
Node value = n.getFirstChild();
JSType type = n.getJSType();
if (value... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
switch (n.getType()) {
case Token.WHILE:
if (CONVERT_WHILE_TO_FOR) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void onRedeclaration(
Scope s, String name, Node n, Node parent, Node gramps,
Node nodeWithLineNumber) {
Preconditions.checkState(n... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private static Node computeFollowNode(
Node fromNode, Node node, ControlFlowAnalysis cfa) {
/*
* This is the case where:
*
* 1. Parent is null implies ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void init(JSSourceFile[] externs, JSModule[] modules,
CompilerOptions options) {
initOptions(options);
checkFirstModule(modules);
this.externs = make... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
Node getNodeForCodeInsertion(JSModule module) {
if (module == null) {
if (inputs.length == 0) {
throw new IllegalStateException("No inputs");
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private static Collection<Definition> getCallableDefinitions(
DefinitionProvider definitionProvider, Node name) {
List<Definition> result = Lists.newArrayList();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
static boolean canBeSideEffected(Node n, Set<String> knownConstants) {
switch (n.getType()) {
case Token.CALL:
case Token.NEW:
// Function calls or cons... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public void enterScope(NodeTraversal t) {
// TODO(user): We CAN do this in the global scope, just need to be
// careful when something is exported. Liveness... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@SuppressWarnings("fallthrough")
private ExtractionInfo extractMultilineTextualBlock(JsDocToken token,
WhitespaceOption ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void trySimplify(Node parent, Node node) {
if (node.getType() != Token.EXPR_RESULT) {
return;
}
Node exprBody = node.getFirstChild();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@VisibleForTesting
static void createDefineReplacements(List<String> definitions,
CompilerOptions options) {
// Parse the definitions
for (String override : def... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
FunctionTypeBuilder inferReturnType(@Nullable JSDocInfo info) {
returnType = info != null && info.hasReturnType() ?
info.getReturnType().evaluate(scope, typeRegistr... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
FunctionType buildAndRegister() {
if (returnType == null) {
returnType = typeRegistry.getNativeType(UNKNOWN_TYPE);
}
if (parametersNode == null) {
thro... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
FunctionType cloneWithNewReturnType(JSType newReturnType, boolean inferred) {
return new FunctionType(
registry, null, null,
new ArrowType(
regi... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private FunctionType getFunctionType(String name,
Node rValue, JSDocInfo info, @Nullable Node lvalueNode) {
FunctionType functionType = null;
// Handle f... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
x
// Test Case
[/INST]
public void testTypeAnnotationsAssign() {
assertTypeAnnotations("/** @constructor */ var Foo = function(){}",
"/**\n * @return {undefined}\n... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean isOneExactlyFunctionOrDo(Node n) {
// For labels with block children, we need to ensure that a
// labeled FUNCTION or DO isn't generated when ex... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public TypePair getTypesUnderInequality(JSType that) {
// unions types
if (that instanceof UnionType) {
TypePair p = that.getTypesUnderInequality(this);
ret... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
if (n.getType() == Token.FUNCTION) {
// Don't traverse functions that are constructors or have ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void visitFunction(NodeTraversal t, Node n) {
FunctionType funType = (FunctionType) n.getJSType();
Node block = n.getLastChild();
Node paramName = N... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
void appendTo(Appendable out) throws IOException {
out.append("[");
out.append(sourceFile);
// The source file rarely changes, so cache the escaped string.... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
void addMapping(Node node, Position startPosition, Position endPosition) {
String sourceFile = (String)node.getProp(Node.SOURCEFILE_PROP);
// If the node does not have... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Node tryFoldTypeof(Node originalTypeofNode) {
Preconditions.checkArgument(originalTypeofNode.getType() == Token.TYPEOF);
Node argumentNode = originalTypeofNode... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void appendTo(Appendable out, String name) throws IOException {
// Write the mappings out to the file. The format of the generated
// source map is three section... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
final protected void setRunOptions(CompilerOptions options)
throws FlagUsageException, IOException {
DiagnosticGroups diagnosticGroups = getDiagnosticGroups();
d... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
protected CompilerOptions createOptions() {
CompilerOptions options = new CompilerOptions();
options.setCodingConvention(new ClosureCodingConvention());
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected int doRun() throws FlagUsageException, IOException {
Compiler.setLoggingLevel(Level.parse(config.loggingLevel));
List<JSSourceFile> externsList = createExter... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private String toSource(Node n, SourceMap sourceMap) {
CodePrinter.Builder builder = new CodePrinter.Builder(n);
builder.setPrettyPrint(options.prettyPrint);
builde... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
x
// Test Case
[/INST]
public void testCharSetExpansion() {
testSame("");
assertEquals("US-ASCII", lastCompiler.getOptions().outputCharset);
args.add("--charset=UT... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean apply(Node n) {
// When the node is null it means, we reached the implicit return
// where the function returns (possibly without an return s... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override public void visit(NodeTraversal t, Node n, Node parent) {
if (n == scope.getRootNode()) return;
if (n.getType() == Token.LP && parent == scope.getRootN... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void initConfigFromFlags(String[] args, PrintStream err) {
// Args4j has a different format that the old command-line parser.
// So we use some voodoo to get th... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
JSType resolveInternal(ErrorReporter t, StaticScope<JSType> scope) {
setResolvedTypeInternal(this);
call = (ArrowType) safeResolve(call, t, scope);
prototype = (Fu... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void scanRoot(Node n, Scope parent) {
if (n.getType() == Token.FUNCTION) {
sourceName = (String) n.getProp(Node.SOURCENAME_PROP);
final Node fnNameNode... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void scanVars(Node n, Node parent) {
switch (n.getType()) {
case Token.VAR:
// Declare all variables. e.g. var x = 1, y, z;
for (Node child = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.