@@ -776,6 +776,7 @@ export class Resolver extends DiagnosticEmitter {
776776 }
777777 if ( isTypedElement ( kind ) ) {
778778 let type = ( < TypedElement > element ) . type ;
779+ assert ( type != Type . void ) ;
779780 let classReference = type . classReference ;
780781 if ( classReference ) {
781782 let wrappedType = classReference . wrappedType ;
@@ -1142,14 +1143,13 @@ export class Resolver extends DiagnosticEmitter {
11421143 /** Resolves a lazily compiled global, i.e. a static class field or annotated `@lazy`. */
11431144 private ensureResolvedLazyGlobal ( global : Global , reportMode : ReportMode = ReportMode . REPORT ) : bool {
11441145 if ( global . is ( CommonFlags . RESOLVED ) ) return true ;
1146+ var type : Type | null ;
11451147 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+ }
11531153 if ( ! type ) return false ;
11541154 global . setType ( type ) ; // also sets resolved
11551155 return true ;
@@ -1174,6 +1174,7 @@ export class Resolver extends DiagnosticEmitter {
11741174 // Resolve variable-likes to their class type first
11751175 switch ( target . kind ) {
11761176 case ElementKind . GLOBAL : if ( ! this . ensureResolvedLazyGlobal ( < Global > target , reportMode ) ) return null ;
1177+ case ElementKind . ENUMVALUE :
11771178 case ElementKind . LOCAL :
11781179 case ElementKind . FIELD : { // someVar.prop
11791180 let type = ( < VariableLikeElement > target ) . type ; assert ( type != Type . void ) ;
0 commit comments