9095548553
Add `LazyExpr` class to represent expressions in the symbol table. Initially they contain a pointer to an expression in the parse tree. After name resolution is complete and symbols are filled in in the parse tree, `LazyExpr`s are resolved to `evaluate::Expr<evaluate::SomeType>`. This is done by `ResolveSymbolExprs()`. Change `Bound` and `ParamValue` to save their value as a `LazyExpr`. Change `ObjectEntityDetails` and `TypeParamDetails` to save the initial value as a `LazyExpr`. Eliminate `IntExpr` and `IntConst` classes, which were just place-holders. Add `Clone()` to `ShapeSpec`, `Bound`, `LazyExpr`. Normally they should be moved but in `ObjectEntityDetails::set_shape()` we need to make copies. Save type parameter values in `derivedTypeSpec_`. `typeParamValue_` is not needed. Write out initial values, type parameter values, and bounds to .mod files. Evaluate parameter values in expressions. Make some errors non-fatal so that tests can continue to pass. Original-commit: flang-compiler/f18@b90cadfc53 Reviewed-on: https://github.com/flang-compiler/f18/pull/223 Tree-same-pre-rewrite: false
52 lines
1.6 KiB
Fortran
52 lines
1.6 KiB
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
|
|
abstract interface
|
|
subroutine foo
|
|
end subroutine
|
|
end interface
|
|
|
|
procedure() :: a
|
|
procedure(integer) :: b
|
|
procedure(foo) :: c
|
|
procedure(bar) :: d
|
|
!ERROR: Explicit interface 'missing' not found
|
|
procedure(missing) :: e
|
|
!ERROR: 'b' is not an abstract interface or a procedure with an explicit interface
|
|
procedure(b) :: f
|
|
procedure(c) :: g
|
|
external :: h
|
|
!ERROR: 'h' is not an abstract interface or a procedure with an explicit interface
|
|
procedure(h) :: i
|
|
|
|
external :: a, b, c, d
|
|
!ERROR: EXTERNAL attribute not allowed on 'm'
|
|
external :: m
|
|
!ERROR: EXTERNAL attribute not allowed on 'foo'
|
|
external :: foo
|
|
!ERROR: EXTERNAL attribute not allowed on 'bar'
|
|
external :: bar
|
|
|
|
!ERROR: PARAMETER attribute not allowed on 'm'
|
|
parameter(m=2)
|
|
!ERROR: PARAMETER attribute not allowed on 'foo'
|
|
parameter(foo=2)
|
|
!ERROR: PARAMETER attribute not allowed on 'bar'
|
|
parameter(bar=2)
|
|
|
|
contains
|
|
subroutine bar
|
|
end subroutine
|
|
end module
|