Skip to content

bug using redirecting constructor in initializer of extension type #55135

Description

@curt-weber

Extension types don't seem to support typed data, for instance Float64x2.
There is a restriction that typed_data isn't extended, but that applies to other types like int, double, which extension types can use.

import 'dart:math';
import 'dart:typed_data';

extension type const Point._(Float64x2 point) implements Float64x2 {
  Point(double x, double y) : point = Float64x2(x, y);
  double get distance => sqrt(point.x * point.x + point.y * point.y);
}

void main() => print(Point(0, 0)); // prints null

I was checking to see if extension types would be more performant in the case of Offset, but using List<double> is actually slower from my tests.

Metadata

Metadata

Labels

legacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions