Skip to content
Snippets Groups Projects
Commit 06f999b8 authored by Ryan Ziegler's avatar Ryan Ziegler
Browse files

minor fixes

parent 59bee98a
No related branches found
No related tags found
1 merge request!70SROA Dynamic constant subst
Pipeline #200399 passed
...@@ -4,6 +4,10 @@ use self::hercules_ir::ir::*; ...@@ -4,6 +4,10 @@ use self::hercules_ir::ir::*;
use crate::*; use crate::*;
/*
* Substitute all uses of a dynamic constant A with dynamic constant B in a
* type. Return the substituted version of the type, once memozied.
*/
pub(crate) fn substitute_dynamic_constants_in_type( pub(crate) fn substitute_dynamic_constants_in_type(
dc_a: DynamicConstantID, dc_a: DynamicConstantID,
dc_b: DynamicConstantID, dc_b: DynamicConstantID,
...@@ -53,6 +57,12 @@ pub(crate) fn substitute_dynamic_constants_in_type( ...@@ -53,6 +57,12 @@ pub(crate) fn substitute_dynamic_constants_in_type(
} }
} }
/*
* Substitute all uses of a dynamic constant A with dynamic constant B in a
* dynamic constant C. Return the substituted version of C, once memoized. Takes
* a mutable edit instead of an editor since this may create new dynamic
* constants, which can only be done inside an edit.
*/
pub(crate) fn substitute_dynamic_constants( pub(crate) fn substitute_dynamic_constants(
dc_a: DynamicConstantID, dc_a: DynamicConstantID,
dc_b: DynamicConstantID, dc_b: DynamicConstantID,
......
...@@ -4,6 +4,7 @@ fn test<x, y : usize>(a : i32[x, y]) -> (i32[x, y], i32[x,y]) { ...@@ -4,6 +4,7 @@ fn test<x, y : usize>(a : i32[x, y]) -> (i32[x, y], i32[x,y]) {
return (a, b); return (a, b);
} }
#[entry]
fn main<x, y, z : usize>() -> i32[y, z] { fn main<x, y, z : usize>() -> i32[y, z] {
let n : i32[y, z]; let n : i32[y, z];
let res = test::<y, z>(n); let res = test::<y, z>(n);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment