specifically knowing the name of the class and the...
# arrow-meta
r
specifically knowing the name of the class and the names of its type arguments
b
There's a transform that we use to generate code, try to take a look on this example using
Transform.newSources
it could help in your case: https://github.com/arrow-kt/arrow-meta/blob/master/compiler-plugin/src/test/kotlin/arrow/meta/quotes/transform/plugins/TransformNewSourcePlugin.kt#L16
r
I don't know if this would be helpful, I'm trying to add a custom typechecking layer to the IDE to provide correct typechecking on a project using the compiler plugin, and part of it requires me to use
TypeProjection.substitute
which takes a closure that must return a KotlinType
I know the class that I would need to return by FqName but I don't know how I can actually get an instance
I found a method in the CLI plugin context but the same method doesn't seem to exist for the IdeContext
s
the easiest I think is to resolve the type from descriptor fqName -> classId -> module.findClassAcrossDeps() -> type
r
Is there a way to do that without a
CompilerContext
? or how can I get that with the IdeContext
s
ah, in ide there should be resolution context I am not good with meta specifically tbh 🙂
r
Arrow meta can intercept the resolution facade
if you look at the source of the arrow ide plugin you will see the proofs plugin does that to inject its own typechecker in the resolution facade
Links to relevant source to follow:
also you can vreate a KotlinType manually with the compiler apis in TypeUtils I believe
i
The Ide context solely contains the application for accessing services ad manipulating the environment.
r
but type checking and analysis can be intercepted in the Resolution Facade which is what highlithers for type checking ask for. Also the typechecker can be injected.
âž• 1
r
I did that and created a custom BindingContext in ResolutionFacade.analyze that will refine the types in question, but even with that working it doesn't work unless I suppress all mismatched type errors for the class in question, which also suppresses the error in a case where it should be presented