-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Rework F'2023 constraint C1167 checking (#83888)
The code that verifies that the type in a TYPE IS or CLASS IS clause is a match or an extension of the type of the SELECT TYPE selector needs rework to avoid emitting a bogus error for a test. Fixes #83612.
- Loading branch information
Showing
4 changed files
with
70 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
! RUN: %python %S/test_errors.py %s %flang_fc1 | ||
! Check F'2023 C1167 | ||
module m | ||
type :: base(kindparam, lenparam) | ||
integer, kind :: kindparam | ||
integer, len :: lenparam | ||
end type | ||
type, extends(base) :: ext1 | ||
contains | ||
procedure :: tbp | ||
end type | ||
type, extends(ext1) :: ext2 | ||
end type | ||
contains | ||
function tbp(x) | ||
class(ext1(123,*)), target :: x | ||
class(ext1(123,:)), pointer :: tbp | ||
tbp => x | ||
end | ||
subroutine test | ||
type(ext1(123,456)), target :: var | ||
select type (sel => var%tbp()) | ||
type is (ext1(123,*)) ! ok | ||
type is (ext2(123,*)) ! ok | ||
!ERROR: Type specification 'ext1(kindparam=234_4,lenparam=*)' must be an extension of TYPE 'ext1(kindparam=123_4,lenparam=:)' | ||
type is (ext1(234,*)) | ||
!ERROR: Type specification 'ext2(kindparam=234_4,lenparam=*)' must be an extension of TYPE 'ext1(kindparam=123_4,lenparam=:)' | ||
type is (ext2(234,*)) | ||
end select | ||
end | ||
end |