Skip to content

Commit 7696e8a

Browse files
committed
Fix #40 - improperly quoted sparams
1 parent 1c4cc4f commit 7696e8a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/stage1/recurse.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Core.Compiler: MethodInstance, IncrementalCompact, insert_node_here!,
22
userefs, SlotNumber, IRCode, compute_basic_blocks, _methods_by_ftype,
33
retrieve_code_info, CodeInfo, SSAValue, finish, complete, non_dce_finish!,
44
GotoNode, GotoIfNot, block_for_inst, ReturnNode, Argument, compact!,
5-
OldSSAValue, NewvarNode
5+
OldSSAValue, NewvarNode, quoted
66

77
using Base.Meta
88

@@ -756,7 +756,7 @@ function transform!(ci, meth, nargs, sparams, N)
756756
op[] = arg_mapping[val.n]
757757
end
758758
if isexpr(val, :static_parameter)
759-
op[] = sparams[val.args[1]]
759+
op[] = quoted(sparams[val.args[1]])
760760
end
761761
end
762762
compact[idx] = stmt = urs[]
@@ -778,7 +778,7 @@ function transform!(ci, meth, nargs, sparams, N)
778778
NewInstruction(Expr(:call, getfield, SSAValue(idx), 2), Any, compact.result[idx][:line]),
779779
true)
780780
elseif isexpr(stmt, :static_parameter)
781-
stmt = sparams[stmt.args[1]]
781+
stmt = quoted(sparams[stmt.args[1]])
782782
if isexpr(orig_stmt, :(=))
783783
orig_stmt.args[2] = stmt
784784
stmt = orig_stmt

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,7 @@ end
192192
@test gradient(x -> max(x...), (1,2,3))[1] == (0.0, 0.0, 1.0)
193193
@test gradient(x -> max(x...), [1,2,3])[1] == [0.0, 0.0, 1.0]
194194

195+
# Issue #40 - Symbol type parameters not properly quoted
196+
@test Diffractor.∂⃖recurse{1}()(Val{:transformations})[1] === Val{:transformations}()
197+
195198
include("pinn.jl")

0 commit comments

Comments
 (0)