forked from M-Labs/artiq
1
0
Fork 0

compiler.embedding: fix an overly lax hasher.

This commit is contained in:
whitequark 2017-03-02 15:28:24 +00:00
parent a79c3c2cff
commit 8c9f157563
1 changed files with 3 additions and 1 deletions

View File

@ -15,7 +15,7 @@ from Levenshtein import ratio as similarity, jaro_winkler
from ..language import core as language_core
from . import types, builtins, asttyped, prelude
from .transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer
from .transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer, TypedtreePrinter
from .transforms.asttyped_rewriter import LocalExtractor
@ -685,6 +685,8 @@ class TypedtreeHasher(algorithm.Visitor):
def freeze(obj):
if isinstance(obj, ast.AST):
return self.visit(obj)
elif isinstance(obj, list):
return hash(tuple(freeze(elem) for elem in obj))
elif isinstance(obj, types.Type):
return hash(obj.find())
else: