move flattenTerms before DesugarStreams