From c6e6227ef9bfb7dc03c5ce728325017eba16d783 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Jul 2014 14:34:59 -0700 Subject: [PATCH] Use have/need data in ArcanistPhutilLibraryLinter Summary: Ref T5640. In D9864, the data this linter pulls out of the map was changed, breaking "use of undeclared function" warnings. Test Plan: ``` >>> Lint for src/future/FutureProxy.php: Error (PHL1) Unknown Symbol Use of unknown function 'qqqqqq'. Common causes are: - Your libphutil/ is out of date. This is the most common cause. Update this copy of libphutil: /INSECURE/devtools/libphutil - Some other library is out of date. Update the library this symbol appears in. - This symbol is misspelled. Spell the symbol name correctly. Symbol name spelling is case-sensitive. - This symbol was added recently. Run `arc liberate` on the library it was added to. - This symbol is external. Use `@phutil-external-symbol`. Use `grep` to find usage examples of this directive. *** ALTHOUGH USUALLY EASY TO FIX, THIS IS A SERIOUS ERROR. *** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT. 15 $this->setProxiedFuture($proxied); 16 } 17 >>> 18 qqqqqq(); 19 } 20 21 public function setProxiedFuture(Future $proxied) { ``` Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Maniphest Tasks: T5640 Differential Revision: https://secure.phabricator.com/D9954 --- src/__phutil_library_map__.php | 11 ++++------- src/lint/linter/ArcanistPhutilLibraryLinter.php | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 2940fb25..c21f06f5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2,13 +2,13 @@ /** * This file is automatically generated. Use 'arc liberate' to rebuild it. + * * @generated * @phutil-library-version 2 */ phutil_register_library_map(array( '__library_version__' => 2, - 'class' => - array( + 'class' => array( 'ArcanistAliasWorkflow' => 'workflow/ArcanistAliasWorkflow.php', 'ArcanistAmendWorkflow' => 'workflow/ArcanistAmendWorkflow.php', 'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php', @@ -208,11 +208,8 @@ phutil_register_library_map(array( 'XUnitTestEngine' => 'unit/engine/XUnitTestEngine.php', 'XUnitTestResultParserTestCase' => 'unit/engine/__tests__/XUnitTestResultParserTestCase.php', ), - 'function' => - array( - ), - 'xmap' => - array( + 'function' => array(), + 'xmap' => array( 'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow', diff --git a/src/lint/linter/ArcanistPhutilLibraryLinter.php b/src/lint/linter/ArcanistPhutilLibraryLinter.php index c127eee5..965d95db 100644 --- a/src/lint/linter/ArcanistPhutilLibraryLinter.php +++ b/src/lint/linter/ArcanistPhutilLibraryLinter.php @@ -66,7 +66,8 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter { $root = phutil_get_library_root($lib); try { - $symbols[$lib] = id(new PhutilLibraryMapBuilder($root))->buildMap(); + $symbols[$lib] = id(new PhutilLibraryMapBuilder($root)) + ->buildFileSymbolMap(); } catch (XHPASTSyntaxErrorException $ex) { // If the library contains a syntax error then there isn't much that we // can do.