Extract selection as method doesn't infer correct return type
brndt opened this issue · comments
Describe the bug
- For instance write
ZIO.succeed(true)
and try to extract it as a method - The method is extracted but the return type is not correct and some pieces are not imported
![Screenshot 2024-06-03 at 18 14 06](https://private-user-images.githubusercontent.com/21007364/336148697-77e225f7-4217-48b8-9b45-5f62440d2f5b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAzNzk4MzMsIm5iZiI6MTcyMDM3OTUzMywicGF0aCI6Ii8yMTAwNzM2NC8zMzYxNDg2OTctNzdlMjI1ZjctNDIxNy00OGI4LTliNDUtNWY2MjQ0MGQyZjViLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA3VDE5MTIxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIyNzQwMjQ1NjM1NzA0YTg4YjE2ZTY2MzIxODFlOTgyYWY0NWFhNGQzMTExOTYyMTE3NzE0NjRmNjNiN2IyZDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IT2oktcjd1vl0qXW1XSqQB9bIF31o29VYG_YgSd-O8o)
Expected behavior
The return type should be inferred correctly with all missing stuff imported.
Maybe also it'd be better not to put the return type or at least add this possibility to the preferences.
Operating system
macOS
Editor/Extension
VS Code
Version of Metals
v1.3.1
Extra context or search terms
No response
Self contained reproduction:
object O {
class C
def foo(i: Int)(implicit o: C) = i
val o = {
implicit val c = new C
foo(2) //extract this as method or val
???
}
}