KT-28324 More exact startOffset for function/constructor declarations

Function/constructor declaration start offset is the start offset of the
corresponding declaration token, if available.
This commit is contained in:
Dmitry Petrov
2018-11-21 18:04:41 +03:00
parent dfe662364d
commit 7dd906db44
26 changed files with 1008 additions and 73 deletions
@@ -44,8 +44,61 @@ public class IrSourceRangesTestCaseGenerated extends AbstractIrSourceRangesTestC
runTest("compiler/testData/ir/sourceRanges/kt17108.kt");
}
@TestMetadata("synthesizedDataClassMembers.kt")
public void testSynthesizedDataClassMembers() throws Exception {
runTest("compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.kt");
@TestMetadata("compiler/testData/ir/sourceRanges/declarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Declarations extends AbstractIrSourceRangesTestCase {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInDeclarations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/sourceRanges/declarations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("classFuns.kt")
public void testClassFuns() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/classFuns.kt");
}
@TestMetadata("classProperties.kt")
public void testClassProperties() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/classProperties.kt");
}
@TestMetadata("classes.kt")
public void testClasses() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/classes.kt");
}
@TestMetadata("fakeOverrides.kt")
public void testFakeOverrides() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/fakeOverrides.kt");
}
@TestMetadata("primaryConstructors.kt")
public void testPrimaryConstructors() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/primaryConstructors.kt");
}
@TestMetadata("secondaryConstructors.kt")
public void testSecondaryConstructors() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.kt");
}
@TestMetadata("synthesizedDataClassMembers.kt")
public void testSynthesizedDataClassMembers() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.kt");
}
@TestMetadata("topLevelFuns.kt")
public void testTopLevelFuns() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/topLevelFuns.kt");
}
@TestMetadata("topLevelProperties.kt")
public void testTopLevelProperties() throws Exception {
runTest("compiler/testData/ir/sourceRanges/declarations/topLevelProperties.kt");
}
}
}