Skip to content

Analysis server gives incorrect invalid override message  #30328

@leafpetersen

Description

@leafpetersen

Given the following three files, the command line analyzer reports no warnings (correctly, I believe):

leafp-macbookpro:tmp leafp$ ~/src/dart-repo/sdk/xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer --strong --supermixin --show-package-warnings ~/tmp/intellij-test-directory/proxy_box.dart 
Analyzing /Users/leafp/tmp/intellij-test-directory/proxy_box.dart...
No issues found!
leafp-macbookpro:tmp leafp$ ~/src/dart-repo/sdk/xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer --version
dartanalyzer version 1.25.0-edge.b176e7de503bcaf888b6208c14726e6e597435f1

However, opening the files in Intellij, with the same SDK build, and with an analysis_options file enabling super mixins produces the following error:

ERROR: Invalid override. The type of 'RenderTransform.applyPaintTransform' ('(RenderBox, Matrix4) → void') isn't a subtype of 'RenderProxyBoxMixin.applyPaintTransform' ('(RenderObject, Matrix4) → void'). (proxy_box.dart:16)

If I remove the covariant from RenderObject.applyPaintTransform, the command line analyzer reports the same error. I suspect the analysis server is losing track of covariant.

Note that this is specific to the code being split into files: if you combine all of the code into one file, the analysis server no longer produces an error.

object.dart

class Matrix4 {}

abstract class RenderObject {
void applyPaintTransform(covariant RenderObject child, Matrix4 transform) {
  }
}

abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> extends RenderObject {
  ChildType _child;
  ChildType get child => _child;
  set child(ChildType value) {}
}

box.dart

import 'object.dart';

abstract class RenderBox extends RenderObject {
  @override
  void applyPaintTransform(RenderObject child, Matrix4 transform) {}
}

proxy_box.dart

import 'box.dart';
import 'object.dart';

abstract class RenderProxyBoxMixin extends RenderBox with RenderObjectWithChildMixin<RenderBox> {
  @override
  void applyPaintTransform(RenderObject child, Matrix4 transform) { }

}

class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox>, RenderProxyBoxMixin {
}


class RenderTransform extends RenderProxyBox {
  @override
  void applyPaintTransform(RenderBox child, Matrix4 transform) {
  }
}

cc @bwilkerson @scheglov

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions