From d19c9f5153c3774c4481e132c1e244bb8a8db6ce Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:21:33 +0100 Subject: [PATCH] fixed files form Closure #17 --- .../17/com/google/javascript/jscomp/TypedScopeCreator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/Closure/17/com/google/javascript/jscomp/TypedScopeCreator.java b/projects/Closure/17/com/google/javascript/jscomp/TypedScopeCreator.java index efaba2c..8bc7bda 100644 --- a/projects/Closure/17/com/google/javascript/jscomp/TypedScopeCreator.java +++ b/projects/Closure/17/com/google/javascript/jscomp/TypedScopeCreator.java @@ -1288,8 +1288,12 @@ private JSType getDeclaredType(String sourceName, JSDocInfo info, if (info.isConstant()) { JSType knownType = null; if (rValue != null) { - if (rValue.getJSType() != null && !rValue.getJSType().isUnknownType()) { + JSDocInfo rValueInfo = rValue.getJSDocInfo(); + if (rValueInfo != null && rValueInfo.hasType()) { // If rValue has a type-cast, we use the type in the type-cast. + return rValueInfo.getType().evaluate(scope, typeRegistry); + } else if (rValue.getJSType() != null + && !rValue.getJSType().isUnknownType()) { // If rValue's type was already computed during scope creation, // then we can safely use that. return rValue.getJSType();