Skip to content
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

Refactoring Field Error Function into one Function #2336

Closed
MahadMuhammad opened this issue Jun 27, 2023 · 0 comments · Fixed by #2341
Closed

Refactoring Field Error Function into one Function #2336

MahadMuhammad opened this issue Jun 27, 2023 · 0 comments · Fixed by #2341

Comments

@MahadMuhammad
Copy link
Contributor

Refactoring Field Error Function

Both the lines you modified have the exact same error message and pattern. I think it would be worth opening an issue to factor them into one function (emit_invalid_field_error or w/ever) in this file, and it's something you can work on if you like. This will make it easier for you to rework the Error emitting code once we get to that point in your GSoC project @MahadMuhammad

Originally posted by @CohenArthur in #2326 (comment)

if (!variant->lookup_field (ident.get_identifier (), &field,
nullptr))
{
rust_error_at (ident.get_locus (), ErrorCode ("E0026"),
"variant %s does not have a field named %s",
variant->get_identifier ().c_str (),
ident.get_identifier ().c_str ());
break;
}

if (!variant->lookup_field (ident.get_identifier (), &field,
nullptr))
{
rust_error_at (ident.get_locus (), ErrorCode ("E0026"),
"variant %s does not have a field named %s",
variant->get_identifier ().c_str (),
ident.get_identifier ().c_str ());
break;
}

MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 28, 2023
Refactored field error function into one function,
to make easier error emission. Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored field
	error function
	(TypeCheckPattern::visit): called 'emit_invalid_field_error' function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 28, 2023
Refactored field error function into one function,
to make easier error emission. Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored field
	error function
	(TypeCheckPattern::visit): called 'emit_invalid_field_error' function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 28, 2023
Refactored field error function into one function,
to make easier error emission. Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored field
	error function
	(TypeCheckPattern::visit): called 'emit_invalid_field_error' function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 28, 2023
Refactored field error function into one function,
to make easier error emission. Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored field
	error function
	(TypeCheckPattern::visit): called 'emit_invalid_field_error' function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 28, 2023
Refactored field error function into one function,
to make easier error emission. Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored field
	error function
	(TypeCheckPattern::visit): called 'emit_invalid_field_error' function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
MahadMuhammad added a commit to MahadMuhammad/gccrs that referenced this issue Jun 29, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
github-merge-queue bot pushed a commit that referenced this issue Jun 30, 2023
Refactored field error function into one funciton
Fixes #2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 15, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 5, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 8, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 11, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 12, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 17, 2024
Refactored field error function into one funciton
Fixes Rust-GCC#2336

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
	Error Function
	(TypeCheckPattern::visit): called emit_invalid_field_error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants