-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Labels
bugSomething not working correctlySomething not working correctlyparameterized modulesRelated to Cryptol's parameterized modulesRelated to Cryptol's parameterized modules
Description
Consider the following parameterized module (B) and instantiation of it (Y):
module B where
parameter
type a: #
type w = 2 ^^ a
type b = 2 ^^ w
module Y = B where
type a = 0
b should be equivalent to 2 ^^ 2 ^^ 0 which, due to (^^) being right-associative, should be equal to 2 ^^ (2 ^^ 0), i.e., 2. Despite this, b is actually equal to 1, not 2:
Y> :m Y
Loading module Cryptol
Loading module `where` argument of Y
Loading interface module `parameter` interface of B
Loading module B
Loading module Y
Y> `b : Integer
1
Compare this to the output of a variant that does not use parameterized module:
module Z where
type a = 0
type w = 2 ^^ a
type b = 2 ^^ w
Z> :m Z
Loading module Cryptol
Loading module Z
Z> `b : Integer
2
Most likely, the parameterized version is incorrectly using the precedence (2 ^^ 2) ^^ 0, which would explain why it computes 1 instead of 2.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething not working correctlySomething not working correctlyparameterized modulesRelated to Cryptol's parameterized modulesRelated to Cryptol's parameterized modules