diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart index 8f62edbb935..f87a613e96b 100644 --- a/pkg/dev_compiler/lib/src/kernel/compiler.dart +++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart @@ -3366,7 +3366,14 @@ class ProgramCompiler extends ComputeOnceConstantVisitor normalizedType, _currentTypeEnvironment); var typeRep = evalInEnvironment(result.requiredEnvironment, result.recipe); - if (_cacheTypes) typeRep = _typeTable.nameType(normalizedType, typeRep); + if (_cacheTypes && + // Avoid adding a the use of a single type parameter to the type + // table. These can be referenced directly because the are already + // represented as a local variable in the scope. + !(normalizedType is TypeParameterType && + normalizedType.isPotentiallyNonNullable)) { + typeRep = _typeTable.nameType(normalizedType, typeRep); + } return typeRep; } on UnsupportedError catch (e) { _typeCompilationError(normalizedType, e.message ?? 'Unknown Error');