forked from M-Labs/artiq
compiler.embedding: fix an overly lax hasher.
This commit is contained in:
parent
a79c3c2cff
commit
8c9f157563
|
@ -15,7 +15,7 @@ from Levenshtein import ratio as similarity, jaro_winkler
|
||||||
|
|
||||||
from ..language import core as language_core
|
from ..language import core as language_core
|
||||||
from . import types, builtins, asttyped, prelude
|
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
|
from .transforms.asttyped_rewriter import LocalExtractor
|
||||||
|
|
||||||
|
|
||||||
|
@ -685,6 +685,8 @@ class TypedtreeHasher(algorithm.Visitor):
|
||||||
def freeze(obj):
|
def freeze(obj):
|
||||||
if isinstance(obj, ast.AST):
|
if isinstance(obj, ast.AST):
|
||||||
return self.visit(obj)
|
return self.visit(obj)
|
||||||
|
elif isinstance(obj, list):
|
||||||
|
return hash(tuple(freeze(elem) for elem in obj))
|
||||||
elif isinstance(obj, types.Type):
|
elif isinstance(obj, types.Type):
|
||||||
return hash(obj.find())
|
return hash(obj.find())
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue