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

Possibly undefined symbol for .length #587

Closed
azihassan opened this issue Aug 18, 2020 · 4 comments · Fixed by #1022
Closed

Possibly undefined symbol for .length #587

azihassan opened this issue Aug 18, 2020 · 4 comments · Fixed by #1022

Comments

@azihassan
Copy link

Desktop (please provide environment info):

  • OS: Ubuntu 18.04 64 bits
  • IDE: Intellij 2020.2
  • Plugin Version 1.25

D compiler and tools (please provide version numbers):

  • dmd: 2.093.0
  • dub: 1.22.0
  • dcd: 0.13.1
  • dscanner: 0.10.0-3-g2a1f96f

Describe the problem
I'm getting a "Possibly undefined symbol" warning for the .length property.

void main(string[] args)
{
    args.length.writeln;
}

Screenshots
2020-08-18-200042_1366x744_scrot

DCD configuration:
2020-08-18-200200_1026x744_scrot

Additional context
Autocompletion works for .length, but the warning is still present.

@azihassan azihassan added the bug label Aug 18, 2020
@SingingBush
Copy link
Member

The way to setup the plugin is just to ensure that phobos and druntime are being picked up as sourcepaths when you select DMD as an sdk:

intellij-dlang-setup-phobos-and-druntime

so you're getting auto completion because DCD is aware of phobos/druntime but the plugin itself has not picked those paths up. Also, if they're configured as sourcepaths you will not need to add them as flags to DCD.

@azihassan
Copy link
Author

Thanks for the reply. I checked the SDK settings and it turns out that the paths are indeed defined :

image

But the problem persists. I also tried removing the flags from DCD, rebuilding, restarting Intellij. Am I missing someting ?

@tsbockman
Copy link

so you're getting auto completion because DCD is aware of phobos/druntime but the plugin itself has not picked those paths up. Also, if they're configured as sourcepaths you will not need to add them as flags to DCD.

The .length property of built-in slices is not from druntime or phobos; it is a language feature. Check out these sections in the spec: Array Properties and Properties.

Similarly, there are also some unrecognized __traits, like identifier; see Traits.

etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 16, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 17, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 17, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 17, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 19, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 19, 2024
etienne02 pushed a commit to etienne02/intellij-dlanguage that referenced this issue Oct 20, 2024
SingingBush pushed a commit that referenced this issue Oct 20, 2024
* Fix content of ReferenceExpression and FunctionCallExpression

* Remove non existent node type

* Remove TemplateMixinExpression node, this node does not exists anymore

* Unary expression: update elements inside based on new parsing

* Pragma: add note to remove expression from his name and remove
expression from his interfaces

Pragma is not an expression, D specs were updated to not show the
expression word anymore (as it is confusing). We should do the same
thing to remove the ambiguity.

* Add types support

This support is not complete and a lot of TODOs remains. But this is
enough to start improve the resolving algorithm

* Use type for improved resolve

* Add resolve test with aliased type

* Add resolve for local definition in ConditionalStatement

* fix(#587): Make PossiblyUndefinedSymbol not reporting error for compiler defined
symbol

* Add resolve for anonymous struct and union fields

* Add test for imported anonymous enum member

* Fix resolve for alias in some cases

Alias value can point to something else than type

* Fix resolve of auto assignment with name shadowing

* Fix caching when psi generation is modified

With this modification, a change in the script will invalidate caches
and so deleted nodes won’t reappear

---------

Co-authored-by: Etienne Brateau <etienne.brateau@gmail.com>
@SingingBush SingingBush added this to the next milestone Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@SingingBush @tsbockman @azihassan @etienne02 and others