Skip to content

self is not constraint in this case, cause soufflé ungrounded error #90

Closed
@ValKmjolnir

Description

@ValKmjolnir
schema A {
    @primary id: int
}

impl A {
    pub fn __all__() -> *Self {
        for (i in int::range(0, 65536)) {
            yield Self { id: i }
        }
    }
    pub fn to_string(self) -> string {
        return "str[" + self.id.to_string() + "]"
    }
}

@output
fn test(n: string) -> bool {
    for (a in A()) {
        return n = a.to_string()
    }
}

generated soufflé contains ungrounded error.

R_1A9to_string(ret?result, self) :- (
  GF_4A_id(ssa_temp_0, self),
                    ^^^^^^^^^ ungrounded
  ssa_temp_1 = to_string(ssa_temp_0),
  ssa_temp_2 = cat("str[", ssa_temp_1),
  ret?result = cat(ssa_temp_2, "]")
).

expect this correct generated code:

R_1A9to_string(ret?result, self) :- (
  GF_4A_id(ssa_temp_0, self),
  ssa_temp_1 = to_string(ssa_temp_0),
  ssa_temp_2 = cat("str[", ssa_temp_1),
  ret?result = cat(ssa_temp_2, "]"),
  TC_1A(self)
).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions