Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot highlight types #2198

Closed
odk211 opened this issue Nov 16, 2021 · 1 comment · Fixed by #2199
Closed

Cannot highlight types #2198

odk211 opened this issue Nov 16, 2021 · 1 comment · Fixed by #2199
Labels
Milestone

Comments

@odk211
Copy link
Sponsor Contributor

odk211 commented Nov 16, 2021

Version

11.13.0

What I was doing

  1. Write module like below.
defmodule Schema do
  alias Schema

  defmacro def_schema(fields) do
    quote bind_quoted: [fields: fields] do
      defstruct Keyword.keys(fields)

      @type t :: %__MODULE__{
                   unquote_splicing(Enum.map(fields, &Schema.spec_field/1))
                 }
    end
  end

  def spec_field(_) do
  end
end
  1. Reopen project

Exceptions

Exception 0

Excerpt

&Schema.spec_field/1

From: schema.ex:8
To: schema.ex:8

Element Class Name

org.elixir_lang.psi.impl.ElixirUnmatchedGreaterThanOrEqualToOnePointSixCaptureNonNumericOperationImpl

Stacktrace

java.lang.Throwable: Cannot highlight types
	at org.elixir_lang.errorreport.Logger.error(Logger.java:42)
	at org.elixir_lang.errorreport.Logger.error(Logger.java:28)
	at org.elixir_lang.annotator.ModuleAttribute.error(ModuleAttribute.kt:123)
	at org.elixir_lang.annotator.ModuleAttribute.cannotHighlightTypes(ModuleAttribute.kt:119)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1050)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1155)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:985)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1194)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1025)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:909)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:909)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:909)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:909)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:878)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:966)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:1062)
	at org.elixir_lang.annotator.ModuleAttribute.highlightTypesAndTypeParameterUsages(ModuleAttribute.kt:909)
	at org.elixir_lang.annotator.ModuleAttribute.highlightType(ModuleAttribute.kt:250)
	at org.elixir_lang.annotator.ModuleAttribute.access$highlightType(ModuleAttribute.kt:31)
	at org.elixir_lang.annotator.ModuleAttribute$annotate$1.visitDeclaration(ModuleAttribute.kt:84)
	at org.elixir_lang.annotator.ModuleAttribute$annotate$1.visitElement(ModuleAttribute.kt:61)
	at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:273)
	at org.elixir_lang.psi.impl.ElixirUnmatchedAtUnqualifiedNoParenthesesCallImpl.accept(ElixirUnmatchedAtUnqualifiedNoParenthesesCallImpl.java:40)
	at org.elixir_lang.annotator.ModuleAttribute.annotate(ModuleAttribute.kt:47)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:134)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:114)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:335)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:268)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:294)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:297)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:94)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:297)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:265)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:211)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:399)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:392)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:391)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:367)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:365)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
@KronicDeth
Copy link
Owner

I can reproduce on main after merging #2179, so this will affect 12.0.0 currently.

@KronicDeth KronicDeth added this to the 12.0.0 milestone Nov 16, 2021
KronicDeth added a commit that referenced this issue Nov 16, 2021
KronicDeth added a commit that referenced this issue Nov 16, 2021
Fixes #2198

`unquote_splicing` is being used to splat arguments or fields of a struct into the type.  The arguments to `unquote_splicing` are normal calls or variables, not types.
KronicDeth added a commit that referenced this issue Nov 16, 2021
KronicDeth added a commit that referenced this issue Nov 16, 2021
Fixes #2198

`unquote_splicing` is being used to splat arguments or fields of a struct into the type.  The arguments to `unquote_splicing` are normal calls or variables, not types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants