Skip to content

Analyzer reports mismatched types on Windows due to drive letter casing #28895

@DanTup

Description

@DanTup

Copying this from Dart-Code/Dart-Code#261 as I don't think it's specific to Dart Code (however, I can't explain why Atom or DartAnalyzer wouldn't show the same issue).

Here is a smaller repro than attached to the Dart Code issue, it's basically:

lib/a.dart

import 'package:repro/b.dart';

class Renderer
{

}

class Mesh extends Renderable
{
    @override
    void render(Renderer r)
    {

    }
}

lib/b.dart

import 'package:repro/a.dart';

abstract class Renderable
{
    void render(Renderer r);
}

There's also a pubspec with just a name and I've run pub get.

The error reported is:

file: 'file:///c%3A/Users/danny/Desktop/repro/repro/lib/a.dart'
severity: 'Error'
message: 'Invalid override. The type of 'Mesh.render' ('(Renderer) → void') isn't a subtype of 'Renderable.render' ('(Renderer) → void').'
at: '11,5'
source: 'dart'

There's only one Renderer class so it seems like these should be the same and the error is incorrect, however the files reference each other, I'm not sure if that's supported?

The log from the AS server is this:

[11:47:34]: ==> {"id":"1","method":"server.setSubscriptions","params":{"subscriptions":["STATUS"]}}
[11:47:34]: ==> {"id":"2","method":"analysis.setAnalysisRoots","params":{"included":["c:\\Users\\danny\\Desktop\\repro\\repro"],"excluded":[]}}
[11:47:34]: <== {"event":"server.connected","params":{"version":"1.17.0","pid":12036,"sessionId":""}}
[11:47:34]: <== {"id":"1"}
[11:47:34]: <== {"event":"server.status","params":{"pub":{"isListingPackageDirs":true}}}
[11:47:34]: <== {"event":"server.status","params":{"pub":{"isListingPackageDirs":false}}}
[11:47:35]: <== {"id":"2"}
[11:47:35]: <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\a.dart","errors":[]}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\a.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\a.dart","offset":113,"length":39,"startLine":11,"startColumn":5},"message":"Invalid override. The type of 'Mesh.render' ('(Renderer) → void') isn't a subtype of 'Renderable.render' ('(Renderer) → void').","code":"strong_mode_invalid_method_override","hasFix":false}]}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\a.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\a.dart","offset":113,"length":39,"startLine":11,"startColumn":5},"message":"Invalid override. The type of 'Mesh.render' ('(Renderer) → void') isn't a subtype of 'Renderable.render' ('(Renderer) → void').","code":"strong_mode_invalid_method_override","hasFix":false}]}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\b.dart","errors":[]}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\b.dart","errors":[]}}
[11:47:35]: <== {"event":"analysis.errors","params":{"file":"c:\\Users\\danny\\Desktop\\repro\\repro\\lib\\b.dart","errors":[]}}
[11:47:35]: <== {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}

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.dart-model-analyzer-specIssues with the analyzer's implementation of the language specos-windowstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions