Vague Compiler Error message

Try to compile this code:

dim obj as Variant
dim ti as Introspection.TypeInfo = Introspection.GetType(obj)
dim mi as Introspection.MethodInfo = ti.GetMethods


Type mismatch error.  
Expected class 
Introspection.MethodInfo, but got class 
dim mi as Introspection.MethodInfo = ti.GetMethods

I know the answer now, but can you see the mistake?

I wish the compiler would be more helpful here…

Hopefully it’s complaining that mi is not an array and should be?


That is the problem, yes, but the error message gives no clue that it’s expecting an Array of specifc type. It just says “Expecting class X but got class X” which is not very helpful!

Oh, I agree with you there. I just realized this was a thought exercise, and now I’m sad the forum doesn’t support spoiler tags.

Looks like this one has been reported before: