Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size is not bound to a value #1992

Closed
WilliamDue opened this issue Jul 22, 2023 · 2 comments
Closed

size is not bound to a value #1992

WilliamDue opened this issue Jul 22, 2023 · 2 comments

Comments

@WilliamDue
Copy link
Contributor

How to replicate the error

I have a Futhark source file err.fut containing the following code.

module type data = {
  val size : i64
  val const : u8 -> [size]u8
}

module make(G: data) = {
  def id (t : [][G.size]u8) : [][G.size]u8 = t
  def const_map (str : []u8) : [][G.size]u8 = map G.const str
}

module thing = make {
  def size : i64 = 3
  def const (_ : u8) : [size]u8 = sized size [1, 2, 3]
}

def f str = thing.const_map str |> thing.id

When I enter the REPL futhark repl err.fut and do f [1, 2, 3] as an example I get the following error.

Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
size is not bound to a value.
-> #0  [0]> :1:1-8

CallStack (from HasCallStack):
  error, called at src/Language/Futhark/Interpreter.hs:654:7 in futhark-0.26.0-8TxRAg15nJlFGbXOt63c7o:Language.Futhark.Interpreter

Version

Futhark 0.26.0 (prerelease - include info below when reporting bugs)
git: 4c7097f183ac8105d4579bef4127e9dd2cfbfed7
@athas
Copy link
Member

athas commented Jul 23, 2023

It's an interpreter bug; probably when it looks up qualified names in sizes.

@athas
Copy link
Member

athas commented Jul 24, 2023

Slightly simplified.

module type data = {
  val size : i64
  val const : u8 -> [size]u8
}

module make(G: data) = {
  def const_map (str : []u8) : [][G.size]u8 = map G.const str
}

module thing = make {
  def size : i64 = 3
  def const (_ : u8) : [size]u8 = sized size [1, 2, 3]
}

entry main str = id (thing.const_map str)

-- ==
-- input { [1u8,2u8,3u8] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants