Add test for a field formal parameter with a default value (#2726)

diff --git a/test/end2end/model_test.dart b/test/end2end/model_test.dart
index 344c383..5a64886 100644
--- a/test/end2end/model_test.dart
+++ b/test/end2end/model_test.dart
@@ -2363,8 +2363,7 @@
           function1,
           topLevelFunction,
           aFunctionUsingRenamedLib;
-      TopLevelVariable aSetterWithFunctionParameter,
-          incorrectDocReference,
+      TopLevelVariable incorrectDocReference,
           incorrectDocReferenceFromEx,
           nameWithTwoUnderscores,
           nameWithSingleUnderscore,
@@ -2393,14 +2392,12 @@
           redHerring,
           yetAnotherName,
           somethingShadowyParameter;
-      Parameter fParam, fParamA, fParamB, fParamC;
       Field forInheriting,
           action,
           initializeMe,
           somethingShadowy,
           aConstructorShadowedField,
           aNameField,
-          anotherNameField,
           yetAnotherNameField,
           initViaFieldFormal;
 
@@ -2506,8 +2503,6 @@
 
         aNameField = FactoryConstructorThings.allFields
             .firstWhere((f) => f.name == 'aName');
-        anotherNameField = FactoryConstructorThings.allFields
-            .firstWhere((f) => f.name == 'anotherName');
         yetAnotherNameField = FactoryConstructorThings.allFields
             .firstWhere((f) => f.name == 'yetAnotherName');
         initViaFieldFormal = FactoryConstructorThings.allFields
@@ -2517,24 +2512,24 @@
             .firstWhere((m) => m.name == 'aMethod');
         yetAnotherName =
             aMethod.allParameters.firstWhere((p) => p.name == 'yetAnotherName');
-
-        aSetterWithFunctionParameter = fakeLibrary.properties
-            .firstWhere((p) => p.name == 'aSetterWithFunctionParameter');
-        fParam = aSetterWithFunctionParameter.parameters
-            .firstWhere((p) => p.name == 'fParam');
-        fParamA = (fParam.modelType as Callable)
-            .parameters
-            .firstWhere((p) => p.name == 'fParamA');
-        fParamB = (fParam.modelType as Callable)
-            .parameters
-            .firstWhere((p) => p.name == 'fParamB');
-        fParamC = (fParam.modelType as Callable)
-            .parameters
-            .firstWhere((p) => p.name == 'fParamC');
       });
 
       group('Parameter references work properly', () {
         test('via a setter with a function parameter', () {
+          var aSetterWithFunctionParameter = fakeLibrary.properties
+              .firstWhere((p) => p.name == 'aSetterWithFunctionParameter');
+          var fParam = aSetterWithFunctionParameter.parameters
+              .firstWhere((p) => p.name == 'fParam');
+          var fParamA = (fParam.modelType as Callable)
+              .parameters
+              .firstWhere((p) => p.name == 'fParamA');
+          var fParamB = (fParam.modelType as Callable)
+              .parameters
+              .firstWhere((p) => p.name == 'fParamB');
+          var fParamC = (fParam.modelType as Callable)
+              .parameters
+              .firstWhere((p) => p.name == 'fParamC');
+
           expect(bothLookup(aSetterWithFunctionParameter, 'fParam.fParamA'),
               equals(MatchingLinkResult(fParamA)));
           expect(bothLookup(aSetterWithFunctionParameter, 'fParam.fParamB'),
@@ -2546,6 +2541,8 @@
         test('in class scope overridden by fields', () {
           expect(bothLookup(FactoryConstructorThings, 'aName'),
               equals(MatchingLinkResult(aNameField)));
+          var anotherNameField = FactoryConstructorThings.allFields
+              .firstWhere((f) => f.name == 'anotherName');
           expect(bothLookup(FactoryConstructorThings, 'anotherName'),
               equals(MatchingLinkResult(anotherNameField)));
           expect(bothLookup(FactoryConstructorThings, 'yetAnotherName'),
@@ -2769,6 +2766,14 @@
         expect(bothLookup(doAwesomeStuff, 'ExtendedBaseReexported.action'),
             equals(MatchingLinkResult(action)));
       });
+
+      test('displays default value of field formal parameter', () {
+        expect(
+            factoryConstructorThingsDefault.linkedParamsLines,
+            contains(
+                '<span class="parameter-name">fieldFormalWithDefault</span> = '
+                '<span class="default-value">7</span>}'));
+      });
     });
   });
 
diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart
index c2a1943..007b319 100644
--- a/testing/test_package/lib/fake.dart
+++ b/testing/test_package/lib/fake.dart
@@ -1263,8 +1263,10 @@
   int anotherName;
   String yetAnotherName;
   final List<String> initViaFieldFormal;
+  final int fieldFormalWithDefault;
 
-  FactoryConstructorThings(this.initViaFieldFormal);
+  FactoryConstructorThings(this.initViaFieldFormal,
+      {this.fieldFormalWithDefault = 7});
 
   factory FactoryConstructorThings.anotherName({
     bool aName,