[Analyzer] Fixes an issue using the lock version of a subspec

Fixed #2135