Skip to content

Fix returning a constant #40

Description

@mariari

When writing the imperative example, I noticed a bug

(defcircuit imperative-example ((output int))
  (let ((accumulator 0))
    (loop for i from 0 to 9
          do (setf accumulator (+ i accumulator)))
    0))

If we return an explicit number

we get an error

The value
  0
is not of type
  SYMBOL
when binding PASS::SYMB
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLY mREPL evaluation request.
 1: [*ABORT] Return to SLY's top level.
 2: [ABORT] abort thread (#<THREAD "sly-channel-1-mrepl-remote-1" RUNNING {1001BB8073}>)

Backtrace:
 0: (PASS::RENAMING-SCHEME 0) [external]
 1: (PASS:RENAME-PRIMITIVE-CIRCUIT #<ALU.IR.PRIMITIVE-GLOBAL:PRIM-CIRCUIT IMPERATIVE-EXAMPLE -> 0 = ..)
 2: (ALU.PIPELINE.PIPELINE:TO-VAMPIR Circuit IMPERATIVE-EXAMPLE = ..)
 3: (ALU.PIPELINE.PIPELINE:PIPELINE Circuit IMPERATIVE-EXAMPLE = ..)
 4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (VAMPIR IMPERATIVE-EXAMPLE) #<NULL-LEXENV>)
 5: (EVAL (VAMPIR IMPERATIVE-EXAMPLE))

; Returning var 0 of frame 1
#<ALU.IR.PRIMITIVE-GLOBAL:PRIM-CIRCUIT IMPERATIVE-EXAMPLE -> 0 =
(#<LET G1441 = #<#<REFERENCE +> 0 0>>
 #<LET G1442 = #<#<REFERENCE +> 1 #<REFERENCE G1441>>>
 #<LET G1443 = #<#<REFERENCE +> 2 #<REFERENCE G1442>>>
 #<LET G1444 = #<#<REFERENCE +> 3 #<REFERENCE G1443>>>
 #<LET G1445 = #<#<REFERENCE +> 4 #<REFERENCE G1444>>>
 #<LET G1446 = #<#<REFERENCE +> 5 #<REFERENCE G1445>>>
 #<LET G1447 = #<#<REFERENCE +> 6 #<REFERENCE G1446>>>
 #<LET G1448 = #<#<REFERENCE +> 7 #<REFERENCE G1447>>>
 #<LET G1449 = #<#<REFERENCE +> 8 #<REFERENCE G1448>>>
 #<LET G1450 = #<#<REFERENCE +> 9 #<REFERENCE G1449>>> #<STANDALONE-RET 0>) : (0)>

It seems the 0 doesn't get renamed for some reason, should be an easy fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions