Length throws TypeError when its null operand is not an As expression (e.g. an expression reference)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
Línea de trabajo
Start with Length.exec in src/elm/overloaded.ts and inspect the translated ELM signature and operand result type mentioned in the issue. Reproduce with the LengthNull examples, checking both expression references and typed null literals. Done when Length(S) returns null and Length(LS) returns 0 without throwing; the issue does not name a test file.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Length throws a TypeError when its argument is null and the operand is not an As expression, for example an expression reference. The typed null literal forms work.
library LengthNull version '1.0.0'
define S: null as String
define LS: null as List<Integer>
define LengthOfNullStringLiteral: Length(null as String) // null
define LengthOfNullStringRef: Length(S) // TypeError
define LengthOfNullListLiteral: Length(null as List<Integer>) // 0
define LengthOfNullListRef: Length(LS) // TypeError
Error for the two failing definitions:
Encountered unexpected error during execution.
Error Message: Cannot read properties of undefined (reading 'type')
CQL Library: LengthNull|1.0.0
Expression: Length
Expected:
Length(S): null, as for a null String (Appendix B; cql-testsLengthNullString);Length(LS): 0, as for a null List (Appendix B; see also #168).
Cause: for a null argument, Length.exec reads this.arg.asTypeSpecifier.type. Only an As operand has asTypeSpecifier; for an ExpressionRef it is undefined:
https://github.com/cqframework/cql-execution/blob/master/src/elm/overloaded.ts#L322
The ELM already carries what is needed to choose the overload. In the translated library above, every Length element has a signature (NamedTypeSpecifier String or ListTypeSpecifier), and the operand has resultTypeName / resultTypeSpecifier. A possible fix is to use the signature or the operand's result type, and not to throw when no type information is present.
Environment:
- cql-execution 3.3.2 and 4.0.0-beta.1 (same line in both);
- ELM from
@cqframework/cql5.8.0 (npm), withEnableResultTypes; - Node 24, Windows 11.
The reference engine has the same pattern: cqframework/clinical_quality_language#1976.
- Lenguaje dominante
- JavaScript
- Estrellas
- 86
- Forks
- 40
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin 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 cqframework/cql-execution
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cqframework/cql-execution#410 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cqframework/cql-execution#407 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
cqframework/cql-execution#406 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
cqframework/cql-execution#414 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
cqframework/cql-execution#413 ·
Todos los issues de cqframework/cql-execution
Issues similares
-
Mend: dependency security vulnerability
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
ManageIQ/manageiq-ui-service#2259 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
electerious/Ackee#411 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
[bug] 提瓦特记事本原石检测框宽度较窄Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
babalae/bettergi-scripts-list#3905 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] "Configure Colota" opens Colota with "Invalid configuration: No configuration data in URL"Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 87/100
dedicatedcode/reitti#1445 ·
Los mantenedores suelen responder en 1 día