ktfmt icon indicating copy to clipboard operation
ktfmt copied to clipboard

Parse file exception with commented import line

Open zanesq opened this issue 4 years ago • 1 comments

Came across into an issue where ktfmt would fail with an exception [ktfmt] e: Failed to parse file with a commented import line like the following

package com.mypackage

import some.package
// import some.commented.out.package
import some.other.package

Looks like it's coming from: https://github.com/facebookincubator/ktfmt/blame/58becb156c72e8d74890f5e8c057d1411205e8c2/core/src/main/java/com/facebook/ktfmt/Formatter.kt#L205

zanesq avatar May 17 '21 18:05 zanesq

@zanesq, it should print "Error: 4:1: error: Imports not contiguous (perhaps a comment separates them?): // import some.commented.out.package"

Does it not? How do you run ktfmt?

cgrushko avatar May 25 '21 15:05 cgrushko

This code does not compile on Kotlin 1.9 and 2.0 (tested), therefore ktfmt will not work either

hick209 avatar Jun 05 '24 18:06 hick209