Invariant typevar matching on callsite checks (#25136)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25136
Previously we were calling unifyType to match typevars at callsites.
unifyType actually does merging (e.g. to handle control flow joins)
so its effect at callsites was bivariance, allowing typevar bindings
to widen as new concrete types were encountered in arguments.
Fixes issue #24856
Strip refinements when doing invariant matching on type vars.
Previous change (bivariance to invariance) makes type matching
sensitive to the addition of type refinements. Use unshapedType
to avoid considering refinements when doing matching.
Test Plan: Imported from OSS
Differential Revision: D17078081
Pulled By: bhosmer
fbshipit-source-id: 54476469679af698cfe9bd020a39de31271f52cc