!7 p-experiment { L tok = javaTokSnippet(#1015725); Map bracketMap = getBracketMap(tok); L l = jfindAll(tok, "? ="); for (int i : l) { S type = or2(tok_inferTypeAt(tok, bracketMap, i+6), "?"); print(tok.get(i+2) + " => " + type); } } sS tok_inferTypeAt(L tok, Map bracketMap, int i) { int j = scanToEndOfInitializer(tok, bracketMap, i); L tok2 = subList(tok, i-1, j+1); printStruct(tok2); fS fname = pairA(tok_parseFunctionCall(tok2)); if (fname == null) null; print("fname: " + fname); S snippetID = stdFunctions_cached().get(fname); if (snippetID == null) null; LL defs = findFullFunctionDefs(javaTokSnippet(snippetID), true); defs = filter(func(L def) -> bool { eq(tok_functionName(def), fname) }, defs); new HashSet types; for (L def : defs) { int k = tok_skipModifiers(def, 1); // TODO: skip type args S type = joinSubList(def, k, indexOf(def, k, fname)-1); types.add(type); } ret singletonOpt(types); }