Tests: add complex tests for references to libraries

These tests check that that complex references (var p by delegate, for in collection, array[index]) are resolved correctly when target descriptors have type parameters
See 41f9dcba911959ddd8220309ea89173f04222c18

 #KT-4505 Fixed