Bug(?)

3 views
Skip to first unread message

Ralf Hemmecke

unread,
Jan 17, 2023, 9:02:08 AM1/17/23
to fricas-devel
I would definitely call the below behaviour a bug.

Isn't it weird that adding type information makes things worse?
And even in case that the interpreter must go another path when I add
"$List(REC)", I don't understand, why it ignores the information that l
is of type List(Integer).

Ralf


(1) -> REC==>Record(foo: Integer, bar: Integer)
Type: Void
(2) -> l: List(Integer) := empty()

(2) []
Type: List(Integer)
(3) -> [[1,1]$REC for x in l]

(3) []
Type: List(Record(foo: Integer,bar: Integer))
(4) -> [[1,1]$REC for x in l]$List(REC)

(4) [[]]
Type: List(Any)

The version [[1,1]$REC for x in l] @ List(REC) works as expected.

When I ")set message bottom on" the output shows the following.

(3) -> [[1,1]$REC for x in l]

(3) []
Type: List(Record(foo: Integer,bar: Integer))
(4) -> [[1,1]$REC for x in l]$List(REC)

Function Selection for map by coercion facility (map)
Arguments: ((ANY -> Record(foo: INT,bar: INT)), LIST(ANY))
Target type: LIST(Record(foo: INT,bar: INT))
-> no appropriate map found in List(Any)
-> no appropriate map found in List(Record(foo: Integer,bar: Integer))
-> no appropriate map found in Record(foo: Integer,bar: Integer)
-> no appropriate map found in Any
-> no appropriate map found in Integer
-> no appropriate map found in Any
-> no appropriate map found in Record(foo: Integer,bar: Integer)

Modemaps from Associated Packages
[1] ((D4 -> D5),List(D4)) -> List(D5) from ListFunctions2(D4,D5)
if D4 has TYPE and D5 has TYPE

[1] signature: ((ANY -> Record(foo: INT,bar: INT)), LIST(ANY)) ->
LIST(Record(foo: INT,bar: INT))
implemented: slot (List (Record (: foo (Integer)) (: bar
(Integer))))(Mapping (Record (: foo (Integer)) (: bar (Integer)))
(Any))(List (Any)) from LIST2(ANY,Record(foo: INT,bar: INT))


(4) [[]]
Type: List(Any)
Reply all
Reply to author
Forward
0 new messages