9727b06813
When a USE statement is encountered, find the scope corresponding to the module. This is now stored in the ModuleDetails of the module symbol. useModuleScope_ tracks this while processing the USE. Currently only modules defined in the same file work because we don't have module files. At the end of a USE that isn't a use-only, add all public names that were not renamed. AddUse() handles recording of a USE by creating a local symbol with UseDetails that tracks the use-symbol in the module and the location of the USE (for error messages). If an ambiguous USE is detected, the UseDetails are replaced by UseErrorDetails. This tracks the locations of all the uses so that they can be referenced in a diagnostic. Detect attempts to re-declare use-associated symbols as well as changing their attributes (except for ASYNCHRONOUS and VOLATILE). Add missing checks for access-stmt in scoping units other than modules. Add tests for the new errors. Reorganize the MessageHandler::Say() overloadings to prevent them from becoming too numerous. Original-commit: flang-compiler/f18@cc0523134c Reviewed-on: https://github.com/flang-compiler/f18/pull/79
24 lines
828 B
Fortran
24 lines
828 B
Fortran
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
|
!
|
|
! Licensed under the Apache License, Version 2.0 (the "License");
|
|
! you may not use this file except in compliance with the License.
|
|
! You may obtain a copy of the License at
|
|
!
|
|
! http://www.apache.org/licenses/LICENSE-2.0
|
|
!
|
|
! Unless required by applicable law or agreed to in writing, software
|
|
! distributed under the License is distributed on an "AS IS" BASIS,
|
|
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
! See the License for the specific language governing permissions and
|
|
! limitations under the License.
|
|
|
|
module m
|
|
public
|
|
!ERROR: The default accessibility of this module has already been declared
|
|
private
|
|
end
|
|
|
|
subroutine s
|
|
!ERROR: PUBLIC statement may only appear in the specification part of a module
|
|
public
|
|
end
|