@@ -525,6 +525,68 @@ describe("Schema", () => {
525525 expect ( new Set ( numberSet ) ) . toEqual ( new Set ( objectSet ) ) ;
526526 } ) ;
527527
528+ it ( 'std::control::value with array literal is offered as a LIST reference in std::list::at' , ( ) => {
529+ // Node 1: std::control::value<T>(value: T): T receives a literal array [1, 2, 3].
530+ // TypeScript infers T = number[], so the node's return type is number[] (LIST<NUMBER>).
531+ //
532+ // Node 2: std::list::at<T>(list: LIST<T>, index: NUMBER): T
533+ // The `list` parameter expects LIST<T> (any array). number[] is assignable to
534+ // LIST<T> (T unconstrained → upper bound unknown → number[] ⊆ unknown[]), so
535+ // node 1 must appear as a ReferenceValue suggestion for the `list` parameter.
536+ const flow : Flow = {
537+ id : "gid://sagittarius/Flow/1" ,
538+ startingNodeId : "gid://sagittarius/NodeFunction/1" ,
539+ signature : "(): void" ,
540+ nodes : {
541+ nodes : [
542+ {
543+ id : "gid://sagittarius/NodeFunction/1" ,
544+ functionDefinition : { identifier : "std::control::value" } ,
545+ nextNodeId : "gid://sagittarius/NodeFunction/2" ,
546+ parameters : {
547+ nodes : [
548+ { value : { __typename : "LiteralValue" , value : [ 1 , 2 , 3 ] } } ,
549+ ] ,
550+ } ,
551+ } ,
552+ {
553+ id : "gid://sagittarius/NodeFunction/2" ,
554+ functionDefinition : { identifier : "std::list::at" } ,
555+ parameters : {
556+ nodes : [
557+ { value : null } ,
558+ { value : { __typename : "LiteralValue" , value : 0 } } ,
559+ ] ,
560+ } ,
561+ } ,
562+ ] ,
563+ } ,
564+ } ;
565+
566+ const [ listSchema ] = getSignatureSchema (
567+ flow ,
568+ DATA_TYPES ,
569+ FUNCTION_SIGNATURES ,
570+ "gid://sagittarius/NodeFunction/2" ,
571+ ) ;
572+
573+ // The `list` parameter is of type LIST<T> → must render as a list input.
574+ expect ( listSchema . schema . input ) . toBe ( "list" ) ;
575+
576+ // Node 1 returns LIST<NUMBER>, which is assignable to LIST<T>.
577+ // Its return value is a direct reference (no property path).
578+ const suggestions = ( listSchema . schema . suggestions ?? [ ] ) as any [ ] ;
579+ expect ( suggestions . length ) . toBeGreaterThan ( 0 ) ;
580+ expect (
581+ suggestions . some (
582+ ( s ) =>
583+ s . __typename === "ReferenceValue" &&
584+ s . nodeFunctionId === "gid://sagittarius/NodeFunction/1" &&
585+ ! s . referencePath ,
586+ ) ,
587+ ) . toBe ( true ) ;
588+ } ) ;
589+
528590 it ( 'demotes select to free-form when function parameter is generic' , ( ) => {
529591 // std::control::return<T>(value: T): T — function declares T, node sets a
530592 // string literal. Result must be text (free-form), NOT select with one option.
0 commit comments