The apostrophe is not the dot product operator, but the adjoint operator (conjugate transpose). The dot product operator is the centred dot (·, which is in many keyboards, but can be also written by the escape secuence \cdot followed by tab). But you need the module LinearAlgebra to use it:
julia> using LinearAlgebra
julia> a, b = 2, 3;
julia> a·b
6
julia> 2·b
6
julia> a·3
6
julia> 2·3
6
Actually, I would also have expected an error in the two first examples (a'b and 2'b). It seems that the “syntax sugar” that allows to omit the multiplication operator in expressions like 2b (equivalent to 2*b) made its magic also in them, but I thought that it only worked in the very specific case of numbers followed without space by a variable name .
Looks like a bug of the adjoint operator ' when used next to number literals. True that at least the given examples are maybe too trivial, but the combination of cases where it works (without even a warning) at it doesn’t seem inconsistent.