dart_eval icon indicating copy to clipboard operation
dart_eval copied to clipboard

an error for dynamic

Open lancexin opened this issue 2 years ago • 1 comments

this is my testcase:

    test('test dynamic2 ', () {
      final runtime = compiler.compileWriteAndLoad({
        'example': {
          'main.dart': '''
        abstract class A {
            A();
            int func1() {
              return 1;
            }
          }

          class B extends A {
            B();
            A func2() {
              return B();
            }

            int func3() {
              return 3;
            }
          }

          dynamic main() {
            dynamic a = B();
            dynamic b = a.func2();
            dynamic c = b.func3();
            print(c);
            return c;
          }
           '''
        }
      });

      expect(runtime.executeLib('package:example/main.dart', 'main'), 3);
    });

error: Null check operator used on a null value resolveInstanceMethod method_invocation.dart:265 _invokeWithTarget method_invocation.dart:199 compileMethodInvocation method_invocation.dart:33 compileExpression expression.dart:34 compileVariableDeclarationList variable_declaration.dart:25 compileVariableDeclarationStatement variable_declaration.dart:12 compileStatement statement.dart:21 compileBlock block.dart:16 compileFunctionDeclaration function.dart:72 compileDeclaration declaration.dart:20 Compiler.compileSources.. compiler.dart:389 dart:collection _LinkedHashMapMixin.forEach Compiler.compileSources. compiler.dart:378 dart:collection _LinkedHashMapMixin.forEach Compiler.compileSources compiler.dart:375 Compiler.compile compiler.dart:142 Compiler.compileWriteAndLoad compiler.dart:444 main..

lancexin avatar May 11 '23 06:05 lancexin

Partially fixed in v0.8.0

ethanblake4 avatar Jul 20 '25 02:07 ethanblake4