Skip to content

Commit 497aca3

Browse files
committed
Repair Proc#parameters to return no names for proc created with Symbol#to_proc
1 parent 0964c6a commit 497aca3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/main/java/org/truffleruby/core/proc/RubyProc.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public int getArityNumber() {
123123
}
124124

125125
public ArgumentDescriptor[] getArgumentDescriptors() {
126+
// parameters can be unnamed in a Proc created using Symbol#to_proc
126127
return argumentDescriptors == null ? arity.toUnnamedArgumentDescriptors() : argumentDescriptors;
127128
}
128129

src/main/java/org/truffleruby/core/symbol/SymbolNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public static RootCallTarget createCallTarget(RubyLanguage language, RubySymbol
226226
0,
227227
"&:" + symbol.getString(),
228228
"Symbol#to_proc",
229-
ArgumentDescriptor.AT_LEAST_ONE);
229+
ArgumentDescriptor.AT_LEAST_ONE_UNNAMED);
230230

231231
// ModuleNodes.DefineMethodNode relies on the lambda CallTarget to always use a RubyLambdaRootNode,
232232
// and we want to use a single CallTarget for both proc and lambda.

src/main/java/org/truffleruby/parser/ArgumentDescriptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public final class ArgumentDescriptor {
3737
public final String name;
3838

3939
public static final ArgumentDescriptor[] ANY_UNNAMED = { new ArgumentDescriptor(ArgumentType.unnamedrest) };
40-
public static final ArgumentDescriptor[] AT_LEAST_ONE = {
41-
new ArgumentDescriptor(ArgumentType.anonreq),
42-
new ArgumentDescriptor(ArgumentType.anonrest) };
40+
public static final ArgumentDescriptor[] AT_LEAST_ONE_UNNAMED = {
41+
new ArgumentDescriptor(ArgumentType.unnamedreq),
42+
new ArgumentDescriptor(ArgumentType.unnamedrest) };
4343
public static final ArgumentDescriptor[] EMPTY_ARRAY = new ArgumentDescriptor[0];
4444

4545
public ArgumentDescriptor(ArgumentType type, String name) {

0 commit comments

Comments
 (0)