diff --git a/rpylean/environment.py b/rpylean/environment.py index 0baf3c8..a717a78 100644 --- a/rpylean/environment.py +++ b/rpylean/environment.py @@ -190,7 +190,7 @@ class Environment(object): self.declarations = declarations #: Any declarations we have already type checked. - self._constants = r_dict(Name.eq, Name.hash) + self._constants = r_dict(Name.eq1, Name.hash1) @not_rpython def __getitem__(self, value): @@ -213,7 +213,7 @@ class Environment(object): """ Construct an environment with the given declarations. """ - by_name = r_dict(Name.eq, Name.hash) + by_name = r_dict(Name.eq1, Name.hash1) for each in declarations: if each.name in by_name: raise AlreadyDeclared(each, by_name) diff --git a/rpylean/objects.py b/rpylean/objects.py index 8f651b3..0afb29b 100644 --- a/rpylean/objects.py +++ b/rpylean/objects.py @@ -107,6 +107,11 @@ class Name(_Item): hash_val ^= compute_hash(c) return hash_val + def eq1(self, other): # xxx RPython workaround, these methods are for r_dict() + return self.eq(other) + def hash1(self): + return self.hash() + def pretty(self, constants): return self.str() @@ -1197,12 +1202,7 @@ class W_Proj(W_Expr): ctor_type = ctor_type.whnf(env) if not isinstance(ctor_type, W_ForAll): raise InvalidProjection(struct_type, self.field_index, i + 1) - # FIXME: this is totally broken, it should be: - # proj = self.struct_name.proj(i, self.struct_expr) - # but RPython seems to freak out with the same hop - # assertion error, even though the type as-is is clearly - # wrong... - proj = W_Proj(struct_type, i, self.struct_expr) + proj = self.struct_name.proj(i, self.struct_expr) ctor_type = ctor_type.body.instantiate(proj, 0) ctor_type = ctor_type.whnf(env)