Skip to content

VM terminates when evaluating any expression for class that extends using itself as a type arg #49209

Closed
@DanTup

Description

@DanTup

This issue was reported to me on Dart-Code's discord. I was able to reduce it to the following:

import 'dart:developer';

void main(List<String> args) {
  final a = A<C>();
  debugger();
}

class A<T> {
  A();
}

class B<T> {
  final T data;
  B(this.data);
}

class C extends B<C> {
  C(C data) : super(data);
}

Running this code under the debugger will pause on the debugger() line. Trying to evaluate any expression at all (even 1) will terminate the VM and the response looks like this:

{
	"jsonrpc": "2.0",
	"error": {
		"code": -32000,
		"message": "Bad state: The client closed with pending request \"evaluateInFrame\".",
		"data": {
			"full": "Bad state: The client closed with pending request \"evaluateInFrame\".",
			"stack": "",
			"request": {
				"id": "35",
				"jsonrpc": "2.0",
				"method": "evaluateInFrame",
				"params": {
					"disableBreakpoints": true,
					"expression": "1",
					"frameIndex": 0,
					"isolateId": "isolates/2111979752828675"
				}
			}
		}
	},
	"id": "35"
}

There is no other error message information (via the VM Service or stderr/stdout) that I can get.

I'm not sure whether class C extends B<C> { makes a lot of sense (it seems like it's impossible to call C's constructor here, since you need to pass a C to it) but I wouldn't expect a crash.

@bkonyi

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions