Honor scalar context for sort returned from a subroutine
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reviewing PR #1992, which is already open and describes the fix across the JVM and interpreter backends. Trace how a subroutine return passes runtime context to sort, then run the focused regression and scalar-sort tests on both backends. Done means scalar callers receive Perl's undef result while list behavior remains covered.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
sort in a subroutine return did not honor the caller's scalar context. Perl returns undef for sort in scalar context, but PerlOnJava returned the number of sorted values. This broke DataCube 0.01's tables method, which returns sort keys ... and is called in scalar context by its test suite.
Minimal reproducer
sub f { return sort qw(a b c) }
my $x = f();
print defined($x) ? "<$x>\n" : "undef\n";
Expected under system Perl: undef
Before the fix, PerlOnJava returned <3> on both JVM and interpreter backends.
Evidence
- CPAN distribution: DataCube 0.01; random tester run
20261106-154847-45334. - System Perl 5.42.2: upstream
make testpassed, 26 tests. - PerlOnJava 5.44.1, build commit
13db7bd4a0:t/00_use.texited 255 on both JVM and interpreter after 15 assertions, withCan't use string ("40") as a HASH ref. - The DataCube test assigns
$cube->tablesto a scalar.DataCube::tablesreturnssort keys ...; the scalar result was then treated as a hash reference.
Confirmed cause and fix
Static scalar-context sort was already handled. In a subroutine return, however, the caller's context is dynamic: PerlOnJava retained the sorted list and generic return handling scalarized it to the list length. PR #1992 passes the runtime context to sort on both backends, preserving input evaluation while skipping the comparator and returning undef for a scalar caller.
The focused regression and existing scalar-sort tests pass on system Perl, JVM, and interpreter. The full repository make and documentation link check pass. The DataCube suite progresses beyond the former failure, but later tests exceed the bounded 180-second runs; a full post-fix DataCube suite pass is not claimed.
- Lenguaje dominante
- Perl
- Estrellas
- 65
- Forks
- 8
- Merge medio
- 5 h 57 min
- PR fusionados (30 d)
- 177
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fglock/PerlOnJava
-
area:runtime documentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fglock/PerlOnJava#1579 ·
Los mantenedores suelen responder en 1 día
-
area:cpan-port area:parser bug
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
fglock/PerlOnJava#1990 ·
Los mantenedores suelen responder en 1 día
-
area:parser area:unicode bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
fglock/PerlOnJava#1989 ·
Los mantenedores suelen responder en 1 día
-
area:backend bug
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
fglock/PerlOnJava#1981 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:runtime bug
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
fglock/PerlOnJava#1980 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de fglock/PerlOnJava
Issues similares
-
check_keywords.pl dies before reporting an unknown keyword categoryPosiblemente ocupada @zhaohai666 la tomó hace 1 día. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 87/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
libwww-perl/HTTP-Message#236 ·
-
1.severity: security
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
wave-followup
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100