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

panic: iterator [[Done]] was not a boolean #2658

Closed
langston-barrett opened this issue Mar 13, 2023 · 2 comments
Closed

panic: iterator [[Done]] was not a boolean #2658

langston-barrett opened this issue Mar 13, 2023 · 2 comments
Assignees
Labels
bug Something isn't working execution Issues or PRs related to code execution
Milestone

Comments

@langston-barrett
Copy link

function AddPromise(){}tests=[{body(){}},{body(){}},{body(){async function*agf(a){for await(m of a){yield}}makeIter=function(){return{next(){return{e:this}}}}
iterTwo={[Symbol.asyncIterator]:makeIter}
const genTwo=agf(iterTwo);AddPromise(this.e,genTwo.next())
AddPromise(this.e,genTwo.next())}}]
for(const test of tests){test.body()}
undefined
thread 'main' panicked at 'iterator [[Done]] was not a boolean', boa_engine/src/vm/opcode/iteration/for_await.rs:24:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:64:14
   2: core::panicking::panic_display
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:147:5
   3: core::panicking::panic_str
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:131:5
   4: core::option::expect_failed
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/option.rs:1924:5
   5: <boa_engine::vm::opcode::iteration::for_await::ForAwaitOfLoopIterate as boa_engine::vm::opcode::Operation>::execute
   6: boa_engine::vm::<impl boa_engine::context::Context>::execute_instruction
   7: boa_engine::vm::<impl boa_engine::context::Context>::run
   8: <boa_engine::native_function::Closure<F,T> as boa_engine::native_function::TraceableClosure>::call
   9: boa_engine::vm::code_block::<impl boa_engine::object::jsobject::JsObject>::call_internal
  10: boa_engine::object::internal_methods::function::function_call{{reify.shim}}
  11: boa_engine::context::hooks::HostHooks::call_job_callback
  12: core::ops::function::FnOnce::call_once{{vtable.shim}}
  13: <boa::Jobs as boa_engine::job::JobQueue>::run_jobs
  14: boa::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@langston-barrett langston-barrett added the bug Something isn't working label Mar 13, 2023
@langston-barrett
Copy link
Author

By the way, this bug, #2657, and others can all be found by simply running boa on all of the files retrieved by this script:

#!/usr/bin/env bash

set -e

repos=(
  "v8/v8"
  "mozilla/gecko-dev"
  "svaarala/duktape"
  "Samsung/escargot"
  "jerryscript-project/jerryscript"
  "chakra-core/ChakraCore"
  "boa-dev/boa"
  "cesanta/elk"
  "Starlight-JS/starlight"
  "denoland/deno"
)
mkdir -p js
for repo in "${repos[@]}"; do
  base=$(basename "${repo}")
  if ! [[ -d "${base}" ]]; then
    git clone --jobs 4 --depth 1 "https://github.com/${repo}"
  fi
  for f in $(find "${base}" -type f -name "*.js"); do 
    echo "${f}"
    cp "${f}" js/"${base}-$(sha256sum "${f}" | head -c 5)-$(basename "${f}")"
  done
done

@jedel1043
Copy link
Member

Minimized:

async function* agf(a) {
  for await (m of a) {
    yield;
  }
}
iterTwo = {
  [Symbol.asyncIterator]: () => ({
    next() {
      return { e: this };
    }
  })
};

const genTwo = agf(iterTwo);
genTwo.next()
genTwo.next()

@jedel1043 jedel1043 added the execution Issues or PRs related to code execution label Mar 14, 2023
@jedel1043 jedel1043 self-assigned this Mar 14, 2023
bors bot pushed a commit that referenced this issue Mar 17, 2023
So, while working on #2658 I apparently broke 1280 tests... except I didn't! Turns out we were considering async tests that didn't call the `print` function as passed tests, but the `async` section of https://github.com/tc39/test262/blob/main/INTERPRETING.md#flags says:
> The test must not be considered complete until the implementation-defined print function has been invoked or some length of time has passed without any such invocation.
@bors bors bot closed this as completed in cb4e49a Mar 21, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants