public static TypeBinding skipResolveInitializerIfAlreadyCalled(Expression expr, BlockScope scope) {
		if (expr.resolvedType != null) return expr.resolvedType;
		try {
			return expr.resolveType(scope);
		} catch (NullPointerException e) {
			return null;
		} catch (ArrayIndexOutOfBoundsException e) {
			// This will occur internally due to for example 'val x = mth("X");', where mth takes 2 arguments.
			return null;
		}
	}
public static TypeBinding skipResolveInitializerIfAlreadyCalled ( Expression expr , BlockScope scope ) { if ( expr . resolvedType != null ) return expr . resolvedType ; try { return expr . resolveType ( scope ) ; } catch ( NullPointerException e ) { return null ; } catch ( ArrayIndexOutOfBoundsException e ) { return null ; } }
and patches .resolve() on LocalDeclaration itself to just-in-time replace the 'val' vartype with the right one.