@infer_type.implementation(for_type=ast.Select)<EOL>def infer_type(expr, scope):
<EOL>if isinstance(expr.key, ast.Literal):<EOL><INDENT>key = expr.key.value<EOL><DEDENT>else:<EOL><INDENT>return protocol.AnyType<EOL><DEDENT>container_type = infer_type(expr.value, scope)<EOL>try:<EOL><INDENT>return associative.reflect(container_type, key) or protocol.AnyType<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>return protocol.AnyType<EOL><DEDENT>
Try to infer the type of x[y] if y is a known value (literal).