ethanblake4/dart_eval

CompileError: Unknown type T at "T value" (file package:default/main.dart)

HXiaoMing opened this issue · 0 comments

Test case:

import 'package:dart_eval/dart_eval.dart';
import 'package:test/test.dart';

void main() {
  group('generic types tests', () {
    test('test generic types method', () {
      final program = '''
            int main () {
              return read(1);
            }
            
            T read<T>(T value) {
              return value;  
            }
      ''';

      eval(program, function: 'main');
    });
  });
}

Error:
package:dart_eval/src/eval/compiler/type.dart 155:7 new TypeRef.fromAnnotation
package:dart_eval/src/eval/compiler/helpers/argument_list.dart 97:29 compileArgumentList
package:dart_eval/src/eval/compiler/expression/method_invocation.dart 172:22 compileMethodInvocation
package:dart_eval/src/eval/compiler/expression/expression.dart 38:12 compileExpression
package:dart_eval/src/eval/compiler/statement/return.dart 24:9 compileReturn
package:dart_eval/src/eval/compiler/statement/statement.dart 31:12 compileStatement
package:dart_eval/src/eval/compiler/statement/block.dart 17:20 compileBlock
package:dart_eval/src/eval/compiler/declaration/function.dart 84:14 compileFunctionDeclaration
package:dart_eval/src/eval/compiler/declaration/declaration.dart 24:5 compileDeclaration
package:dart_eval/src/eval/compiler/compiler.dart 492:11 Compiler.compileSources..
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 481:15 Compiler.compileSources.
dart:collection _LinkedHashMapMixin.forEach
package:dart_eval/src/eval/compiler/compiler.dart 477:32 Compiler.compileSources
package:dart_eval/src/eval/compiler/compiler.dart 164:12 Compiler.compile
package:dart_eval/src/eval/eval.dart 40:28 eval
test/set_value_test.dart 17:7 main..

CompileError: Unknown type T at "T value" (file package:default/main.dart)