Skip to content

Commit 1c48aa7

Browse files
Merge pull request #789 from dart-lang:latest_deps
PiperOrigin-RevId: 707624429
2 parents 85af696 + 23fe0b6 commit 1c48aa7

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
## 5.4.6
2-
3-
* When formatting a generated mocks library, use the language version of the
4-
library with the mockito annotation.
5-
61
## 5.4.5
72

83
* Ignore "must_be_immutable" warning in generated files. Mocks cannot be made
@@ -26,9 +21,9 @@
2621

2722
## 5.4.3
2823

29-
* Require analyzer 5.12.0, allow analyzer version 6.x.
24+
* Require analyzer 5.12.0, allow analyzer version 6.x;
3025
* Add example of writing a class to mock function objects.
31-
* Add support for the `build_extensions` build.yaml option.
26+
* Add support for the `build_extensions` build.yaml option
3227
* Require Dart >=3.1.0.
3328
* **Potentially breaking** Changed default `String` value returned by nice
3429
mocks' unstubbed method to include some useful info. This could break the

lib/src/builder.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ class MockBuilder implements Builder {
141141
orderDirectives: true,
142142
useNullSafetySyntax: sourceLibIsNonNullable);
143143
final rawOutput = mockLibrary.accept(emitter).toString();
144-
144+
// The source lib may be pre-null-safety because of an explicit opt-out
145+
// (`// @dart=2.9`), as opposed to living in a pre-null-safety package. To
146+
// allow for this situation, we must also add an opt-out comment here.
145147
final mockLibraryContent =
146-
DartFormatter(languageVersion: entryLib.languageVersion.effective)
148+
DartFormatter(languageVersion: DartFormatter.latestLanguageVersion)
147149
.format('''
148150
// Mocks generated by Mockito $packageVersion from annotations
149151
// in ${entryLib.definingCompilationUnit.source.uri.path}.
@@ -193,7 +195,7 @@ $rawOutput
193195
interface.typeArguments.forEach(addTypesFrom);
194196
interface.allSupertypes.forEach(addTypesFrom);
195197
case final analyzer.RecordType record:
196-
record.positionalFields.map((e) => e.type).forEach(addTypesFrom);
198+
record.positionalTypes.forEach(addTypesFrom);
197199
record.namedFields.map((e) => e.type).forEach(addTypesFrom);
198200
}
199201
}

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: mockito
2-
version: 5.4.6
2+
version: 5.4.5
33
description: >-
44
A mock framework inspired by Mockito with APIs for Fakes, Mocks,
55
behavior verification, and stubbing.
@@ -30,5 +30,5 @@ dev_dependencies:
3030
build_web_compilers: ^4.0.11
3131
http: ^1.0.0
3232
lints: ^5.1.0
33-
package_config: ^2.1.1
33+
package_config: ^2.1.0
3434
test: ^1.24.4

0 commit comments

Comments
 (0)