Skip to content

Commit dc42e91

Browse files
authored
make ModuleBuidler add 'allow_constraint' and 'allow_witness' attributes to generated functions (#229)
1 parent 13264f6 commit dc42e91

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fixed:
2+
- ModuleBuidler now adds 'allow_constraint' and 'allow_witness' attributes to generated functions

lib/Dialect/Shared/Builders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ ModuleBuilder &ModuleBuilder::insertComputeFn(StructDefOp op, Location loc) {
112112
ensureNoSuchComputeFn(op.getName());
113113

114114
OpBuilder opBuilder(op.getBodyRegion());
115-
116115
auto fnOp = opBuilder.create<FuncDefOp>(
117116
loc, StringAttr::get(context, FUNC_NAME_COMPUTE),
118117
FunctionType::get(context, {}, {op.getType()})
119118
);
119+
fnOp.setAllowWitnessAttr();
120120
fnOp.addEntryBlock();
121121
computeFnMap[op.getName()] = fnOp;
122122
return *this;
@@ -126,11 +126,11 @@ ModuleBuilder &ModuleBuilder::insertConstrainFn(StructDefOp op, Location loc) {
126126
ensureNoSuchConstrainFn(op.getName());
127127

128128
OpBuilder opBuilder(op.getBodyRegion());
129-
130129
auto fnOp = opBuilder.create<FuncDefOp>(
131130
loc, StringAttr::get(context, FUNC_NAME_CONSTRAIN),
132131
FunctionType::get(context, {op.getType()}, {})
133132
);
133+
fnOp.setAllowConstraintAttr();
134134
fnOp.addEntryBlock();
135135
constrainFnMap[op.getName()] = fnOp;
136136
return *this;

0 commit comments

Comments
 (0)