In a way it makes sense, but it's also confusing. PostgreSQL somehow gets confused and keeps on using an old internally compiled version of the function instead of newly compiling it at first use. This is caused by creating a function that has more characters in it than PostgreSQL's compiled-in block size. For example, if PostgreSQL's compiled-in block size is 16k then you won't be able to create functions that are bigger than 16k. The default block size for PostgreSQL is 8k.
Every character counts, even spaces, tabs and comments.
Removing white space and comments until the function fits within the block-size limit does work. Split the function into a number of parts, and have those parts called by a wrapper function. This works fine also, but is difficult to manage, especially when you need to add code in the middle of the entire function. Recompile PostgreSQL with a larger block-size. This has both advantages and drawbacks.