I had one function inside of a function library, then I created another function and copied all the stuff from the first function in there and created all the local variables manually so they have the same name as in the other function and all references to this variables work. Then I changed one of the variables from type Actor to Vector and compiled, and suddenly in the first function the variable was also changed from Vector to Actor. Then changed it back in the first function, compiled, and after this it was set to Actor in the second function.
Then I deleted the variable completely out of the second function and deleted all references and created the variable and references manually again and now it works, having the variable with same name but different type in both functions.