-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: error resilient errors #5354
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
module Geometry | ||
implicit none | ||
|
||
type :: Circle | ||
real :: radius | ||
contains | ||
procedure :: calculateArea | ||
end type Circle | ||
|
||
contains | ||
|
||
! Type-bound subroutine to calculate the area of a circle | ||
subroutine calculateArea(self, area) | ||
class(Circle), intent(in) :: self | ||
real, intent(out) :: area | ||
area = 3.14 * self%radius**2 | ||
end subroutine calculateArea | ||
end module Geometry | ||
|
||
program continue_compilation_2 | ||
use iso_c_binding, only: c_ptr, c_f_pointer | ||
use Geometry | ||
implicit none | ||
|
||
|
||
! Variable declarations | ||
type(c_ptr) :: queries_1 | ||
integer, pointer :: y_1 | ||
type(c_ptr) :: queries_2 | ||
integer(2), pointer :: y_2(:) | ||
integer :: shape(2, 2) | ||
integer, parameter :: x = 2 | ||
type(Circle) :: myCircle | ||
real :: circleArea | ||
complex :: a | ||
|
||
|
||
! c_f_pointer_01 | ||
call c_f_pointer(queries_1, y_1, [2]) | ||
print *, "First error skipped" | ||
|
||
|
||
! c_f_pointer_02 | ||
call c_f_pointer(queries_2, y_2, shape) | ||
print *, "Second error skipped" | ||
|
||
|
||
! assign_01 | ||
x = 1 | ||
print *, x | ||
print *, "Third error skipped" | ||
|
||
|
||
! class_procedure_extra_args | ||
myCircle%radius = 5.0 | ||
call myCircle%calculateArea(circleArea, 12) | ||
print *, "Fourth error skipped" | ||
|
||
|
||
! close_invalid_kwarg1 | ||
CLOSE(end=200) | ||
print *, "Fifth error skipped" | ||
|
||
|
||
! cmplx_01 | ||
a = cmplx(y = 2) | ||
print *, a | ||
print *, "Sixth error skipped" | ||
|
||
|
||
! cmplx_02 | ||
print*, cmplx((real(1, kind=4), 0.00000000), kind=8) | ||
print *, "Seventh error skipped" | ||
|
||
|
||
! cmplx_03 | ||
print*, cmplx((1.00000000, real(0, kind=4)), kind=8) | ||
print *, "Eighth error skipped" | ||
|
||
|
||
end program |
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,13 @@ | ||
{ | ||
"basename": "run-continue_compilation_2-3499257", | ||
"cmd": "lfortran --continue-compilation --no-color {infile}", | ||
"infile": "tests/errors/continue_compilation_2.f90", | ||
"infile_hash": "b71a5a257c1ab04d40c581edd5f801a9e20f7f2e42d57a6330ef8692", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": "run-continue_compilation_2-3499257.stdout", | ||
"stdout_hash": "cee82c23e3fc58c9e6573690402e361306f64bbb9d297e25e6143900", | ||
"stderr": "run-continue_compilation_2-3499257.stderr", | ||
"stderr_hash": "e60cbe29bc8eba0880d486d80cb97f8d7bafc6bbb5379f5234453cca", | ||
"returncode": 1 | ||
} |
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,38 @@ | ||
semantic error: shape argument specified in c_f_pointer even though fptr is not an array. | ||
--> tests/errors/continue_compilation_2.f90:39:38 | ||
| | ||
39 | call c_f_pointer(queries_1, y_1, [2]) | ||
| ^^^ | ||
|
||
semantic error: shape array passed to c_f_pointer must be of rank 1 but given rank is 2 | ||
--> tests/errors/continue_compilation_2.f90:44:38 | ||
| | ||
44 | call c_f_pointer(queries_2, y_2, shape) | ||
| ^^^^^ | ||
|
||
semantic error: Cannot assign to a constant variable | ||
--> tests/errors/continue_compilation_2.f90:49:5 | ||
| | ||
49 | x = 1 | ||
| ^^^^^ assignment here | ||
| | ||
32 | integer, parameter :: x = 2 | ||
| ~~~~~ declared as constant | ||
|
||
semantic error: More actual than formal arguments in procedure call | ||
--> tests/errors/continue_compilation_2.f90:56:33 | ||
| | ||
56 | call myCircle%calculateArea(circleArea, 12) | ||
| ^^^^^^^^^^^^^^ | ||
|
||
semantic error: Invalid argument `end` supplied | ||
--> tests/errors/continue_compilation_2.f90:61:5 | ||
| | ||
61 | CLOSE(end=200) | ||
| ^^^^^^^^^^^^^^ | ||
|
||
semantic error: The first argument of `cmplx` intrinsic must be present | ||
--> tests/errors/continue_compilation_2.f90:66:9 | ||
| | ||
66 | a = cmplx(y = 2) | ||
| ^^^^^^^^^^^^ |
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,10 @@ | ||
First error skipped | ||
Second error skipped | ||
2 | ||
Third error skipped | ||
Fourth error skipped | ||
Fifth error skipped | ||
2.00000000e+00 0.00000000e+00 | ||
Sixth error skipped | ||
Seventh error skipped | ||
Eighth error skipped |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's shorten these to just:
Seems a lot shorter and removes noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will apply this changes here : #5374