ethanblake4/dart_eval

type 'bool' is not a subtype of type '$Value?' in type cast

Noobware1 opened this issue · 2 comments

Test case

 test('List.where', () {
      final runtime = compiler.compileWriteAndLoad({
        'example': {
          'main.dart': '''
            Iterable<int> main() {
              final List<int> a = [1, 2, 1, 4, 1];              
              return a.where((element) => element == 1);
            }
          ''',
        }
      });
      expect(
          ((runtime.executeLib('package:example/main.dart', 'main') as $Value)
                  .$reified as Iterable)
              .toList(),
          [$int(1), $int(1), $int(1)]);
    });

Error

type 'bool' is not a subtype of type '$Value?' in type cast
package:dart_eval/src/eval/runtime/function.dart 60:32          EvalFunctionPtr.call
package:dart_eval/src/eval/shared/stdlib/core/list.dart 497:28  $List._where.<fn>
dart:core                                                       Iterable.toList
test\stdlib_test.dart 204:16                                    main.<fn>.<fn>

also here's the bridgeCall callstack. left is op and right is return value

{PushScope (F7:129, '<anonymous closure>'), Instance of '$Iterable<dynamic>'}
{PushConstantInt (1), Instance of '$Iterable<dynamic>'}
{BoxInt (L2), Instance of '$Iterable<dynamic>'}
{CheckEq (L1 == L2), Instance of '$Iterable<dynamic>'}
{PushReturnValue (), true}
{Return (L3), true}

Fixed in 2ac3fa5