Bug 392759 - PHP error parser on namespace with a word "String"
Summary: PHP error parser on namespace with a word "String"
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: 5.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-05 14:05 UTC by Tomasz Narloch
Modified: 2018-06-13 20:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.3.0


Attachments
php parser error on namespace with text String (115.95 KB, image/png)
2018-04-05 14:05 UTC, Tomasz Narloch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Narloch 2018-04-05 14:05:52 UTC
Created attachment 111849 [details]
php parser error on namespace with text String

Kdevelop does not properly parse namespace with the text "String", e.g.

namespace Joomla\String;

use Joomla\String\StringHelper;

After finding one of the above lines, Kdevelop stops parsing the rest of the file.
Highlight also does not work on the same php file.
Comment 1 Heinz Wiesinger 2018-06-13 20:28:22 UTC
Git commit 8c5e258640e8c70889ba1b3f796d3143240a7cda by Heinz Wiesinger.
Committed on 13/06/2018 at 19:10.
Pushed by wiesinger into branch 'master'.

Fix using reserved type names in identifiers.

Summary:
Remove special tokens for base type names (PHP itself doesn't
have them either in their AST). Unfortunately, keeping them,
while cleaner, is also a lot more complicated and would leave
us with double the amount of FIRST/FIRST conflicts in the grammar.
(Mostly when NamespacedIdentifiers would conflict with base types
in typehints. Think 'String\Stringhandler $foo' vs 'string $bar'.

Removing the tokens essentially immediately resolves the bug,
with the remaining work just being error handling and a bit of
cleanup.
Related: bug 395305
FIXED-IN: 5.3.0

Reviewers: mwolff

Reviewed By: mwolff

Subscribers: mwolff, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D13313

M  +0    -5    completion/context.cpp
M  +64   -2    duchain/builders/declarationbuilder.cpp
M  +3    -0    duchain/builders/declarationbuilder.h
M  +4    -4    duchain/builders/usebuilder.cpp
M  +5    -4    duchain/expressionvisitor.cpp
M  +71   -32   duchain/helper.cpp
M  +3    -0    duchain/helper.h
M  +193  -1    duchain/tests/duchain.cpp
M  +6    -0    duchain/tests/duchain.h
M  +7    -19   parser/php.g
M  +0    -10   parser/phplexer.cpp
M  +1    -1    parser/test/lexertest.cpp

https://commits.kde.org/kdev-php/8c5e258640e8c70889ba1b3f796d3143240a7cda