From 8c9f15756363e08bf2b660ede97a87dc009d558c Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 2 Mar 2017 15:28:24 +0000 Subject: [PATCH] compiler.embedding: fix an overly lax hasher. --- artiq/compiler/embedding.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/embedding.py b/artiq/compiler/embedding.py index 99a11e558..f08d4c508 100644 --- a/artiq/compiler/embedding.py +++ b/artiq/compiler/embedding.py @@ -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: