Constant propagation outside functions

I am confused about the rules of constant propagation in expressions which are outside functions. Specifically, my use case would be exploratory data analysis using building blocks of the DataFrames API, such as groupby etc, where I specify columns using symbols.

The MWE (using DataFrames#master) is

julia> VERSION
v"1.1.0-DEV.841"

julia> using DataFrames, Test

julia> df = DataFrame(a = 1:3, b = ones(3))
3×2 DataFrame
│ Row │ a     │ b       │
│     │ Int64 │ Float64 │
├─────┼───────┼─────────┤
│ 1   │ 1     │ 1.0     │
│ 2   │ 2     │ 1.0     │
│ 3   │ 3     │ 1.0     │

julia> @inferred getproperty(df, :a)
ERROR: return type Array{Int64,1} does not match inferred return type AbstractArray{T,1} where T
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0

julia> @inferred identity(df.a)
3-element Array{Int64,1}:
 1
 2
 3

Why does it infer in one case but not the other?

This

is equivalent to

x = df.a
@inferred identity(x)

which of course is fine.

Thanks, that clarifies it somewhat. The broader question is whether I need to wrap expressions in a function to get constant propagation at the top level when using symbols for columns keys.