Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect import of classes in files that are part of a library in 5.0.0-nullsafety.1 #310

Closed
denniskaselow opened this issue Jan 1, 2021 · 1 comment
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@denniskaselow
Copy link

denniskaselow commented Jan 1, 2021

This works in 5.0.0-nullsafety.0 but doesn't work in 5.0.0-nullsafety.1:

// foobar.dart
library foobar;

part 'src/part.dart';

class Foo {
  void doSomething(Part part) {}
}

// src.part.dart
part of foobar;

class Part {}

// foobar_test.dart
import 'package:foobar/foobar.dart';
import 'package:mockito/annotations.dart';
import 'package:test/test.dart';

import 'foobar_test.mocks.dart';

@GenerateMocks([Part])
void main() {
  test('do something', () {
    final foo = Foo();
    final part = MockPart();

    foo.doSomething(part);
  });
}

5.0.0-nullsafety.0 correctly imports foobar in foobar_test.mocks.dart:

import 'package:mockito/mockito.dart' as _i1;
import 'package:foobar/foobar.dart' as _i2;

5.0.0-nullsafety.1 incorrectly imports the part file instead of the library in foobar_test.mocks.dart:

import 'package:mockito/mockito.dart' as _i1;
import 'package:foobar/src/part.dart' as _i2;

Happy new year by the way ;).

@srawlins
Copy link
Member

srawlins commented Jan 6, 2021

Ouch. *cringe* sorry about that. Good catch.

@srawlins srawlins added P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 6, 2021
@srawlins srawlins self-assigned this Jan 6, 2021
srawlins added a commit that referenced this issue Jan 12, 2021
Fixes #310

PiperOrigin-RevId: 350604317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants