Issue 32290. Tests only, already works.

Bug: https://github.com/dart-lang/sdk/issues/32290
Change-Id: Ic4581f0a531a9460f8764e8dd190cc50a19de0f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323228
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
index 6dd24f5..c664a93 100644
--- a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
@@ -503,6 +503,29 @@
 ''');
   }
 
+  test_instanceCreation_generic_noTypeArguments_inferred_imported() async {
+    newFile('$testPackageLibPath/a.dart', r'''
+class A<T> {
+  final T t;
+  const A(this.t);
+}
+const Object a = const A(0);
+''');
+
+    await assertNoErrorsInCode('''
+import 'a.dart';
+
+const b = a;
+''');
+
+    final result = _topLevelVar('b');
+    assertDartObjectText(result, r'''
+A<int>
+  t: int 0
+  variable: self::@variable::b
+''');
+  }
+
   /// https://github.com/dart-lang/sdk/issues/53029
   /// Dependencies of map patterns should be considered.
   test_mapPattern_dependencies() async {
diff --git a/pkg/analyzer/test/src/summary/elements_test.dart b/pkg/analyzer/test/src/summary/elements_test.dart
index c7cbaec..36de5e0 100644
--- a/pkg/analyzer/test/src/summary/elements_test.dart
+++ b/pkg/analyzer/test/src/summary/elements_test.dart
@@ -15993,6 +15993,63 @@
 ''');
   }
 
+  test_const_invokeConstructor_generic_noTypeArguments_inferred() async {
+    var library = await buildLibrary(r'''
+class A<T> {
+  final T t;
+  const A(this.t);
+}
+const Object a = const A(0);
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    classes
+      class A @6
+        typeParameters
+          covariant T @8
+            defaultType: dynamic
+        fields
+          final t @23
+            type: T
+        constructors
+          const @34
+            parameters
+              requiredPositional final this.t @41
+                type: T
+                field: self::@class::A::@field::t
+        accessors
+          synthetic get t @-1
+            returnType: T
+    topLevelVariables
+      static const a @60
+        type: Object
+        shouldUseTypeForInitializerInference: true
+        constantInitializer
+          InstanceCreationExpression
+            keyword: const @64
+            constructorName: ConstructorName
+              type: NamedType
+                name: A @70
+                element: self::@class::A
+                type: A<int>
+              staticElement: ConstructorMember
+                base: self::@class::A::@constructor::new
+                substitution: {T: int}
+            argumentList: ArgumentList
+              leftParenthesis: ( @71
+              arguments
+                IntegerLiteral
+                  literal: 0 @72
+                  staticType: int
+              rightParenthesis: ) @73
+            staticType: A<int>
+    accessors
+      synthetic static get a @-1
+        returnType: Object
+''');
+  }
+
   test_const_invokeConstructor_generic_unnamed() async {
     var library = await buildLibrary(r'''
 class C<K, V> {