@@ -776,6 +776,7 @@ export class Resolver extends DiagnosticEmitter {
776
776
}
777
777
if ( isTypedElement ( kind ) ) {
778
778
let type = ( < TypedElement > element ) . type ;
779
+ assert ( type != Type . void ) ;
779
780
let classReference = type . classReference ;
780
781
if ( classReference ) {
781
782
let wrappedType = classReference . wrappedType ;
@@ -1142,14 +1143,13 @@ export class Resolver extends DiagnosticEmitter {
1142
1143
/** Resolves a lazily compiled global, i.e. a static class field or annotated `@lazy`. */
1143
1144
private ensureResolvedLazyGlobal ( global : Global , reportMode : ReportMode = ReportMode . REPORT ) : bool {
1144
1145
if ( global . is ( CommonFlags . RESOLVED ) ) return true ;
1146
+ var type : Type | null ;
1145
1147
var typeNode = global . typeNode ;
1146
- if ( ! typeNode ) return false ;
1147
- var type = this . resolveType ( // reports
1148
- typeNode ,
1149
- global . parent ,
1150
- null ,
1151
- reportMode
1152
- ) ;
1148
+ if ( typeNode ) {
1149
+ type = this . resolveType ( typeNode , global . parent , null , reportMode ) ;
1150
+ } else {
1151
+ type = this . resolveExpression ( assert ( global . initializerNode ) , global . file . startFunction . flow , Type . auto , reportMode ) ;
1152
+ }
1153
1153
if ( ! type ) return false ;
1154
1154
global . setType ( type ) ; // also sets resolved
1155
1155
return true ;
@@ -1174,6 +1174,7 @@ export class Resolver extends DiagnosticEmitter {
1174
1174
// Resolve variable-likes to their class type first
1175
1175
switch ( target . kind ) {
1176
1176
case ElementKind . GLOBAL : if ( ! this . ensureResolvedLazyGlobal ( < Global > target , reportMode ) ) return null ;
1177
+ case ElementKind . ENUMVALUE :
1177
1178
case ElementKind . LOCAL :
1178
1179
case ElementKind . FIELD : { // someVar.prop
1179
1180
let type = ( < VariableLikeElement > target ) . type ; assert ( type != Type . void ) ;
0 commit comments