Refine type of ClassTypeAlias.declaredElement.

This is an API change, but it's non-breaking, because
ClassTypeAlias.declaredElement has always returned a ClassElement; its
return type simply didn't reflect that fact.

Change-Id: I45bcfe1b371953e86f9690b7727be89a835841a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106681
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 54c3fde..f0d1b34a 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -18,6 +18,9 @@
   `parseDirectives`.  Note that there is no option to parse only directives,
   since this functionality is broken anyway (`parseDirectives`, despite its
   name, parses the entire compilation unit).
+* Changed the return type of `ClassTypeAlias.declaredElement` to `ClassElement`.
+  There is no functional change; it has always returned an instance of
+  `ClassElement`.
 
 ## 0.36.3
 * Deprecated `AstFactory.compilationUnit`.  In a future analyzer release, this
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index c629f96..a7b03cd 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -1051,6 +1051,9 @@
   /// Set the token for the 'abstract' keyword to the given [token].
   void set abstractKeyword(Token token);
 
+  @override
+  ClassElement get declaredElement;
+
   /// Return the token for the '=' separating the name from the definition.
   Token get equals;
 
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index d5a4880..3d4d114 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -769,8 +769,7 @@
 
   @override
   js_ast.Statement visitClassTypeAlias(ClassTypeAlias node) {
-    return _emitClassDeclaration(
-        node, node.declaredElement as ClassElement, []);
+    return _emitClassDeclaration(node, node.declaredElement, []);
   }
 
   @override