mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 19:28:26 +08:00
compiler.embedding: fix an overly lax hasher.
This commit is contained in:
parent
fd5cdb7d1e
commit
007ae00459
@ -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
Block a user