[question?] counterintuitive class method behaviour
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với truy vấn và đầu ra CodeQL được hiển thị trong issue, sau đó đọc tài liệu về các phương thức của lớp và việc đánh giá predicate. Xác nhận hành vi dự kiến và xác định phần tài liệu liên quan; được xem là hoàn tất khi hành vi được giải thích đủ rõ để giải quyết khoảng trống trong mô hình tư duy đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When I write a query like this:
class Meow extends Struct {
Field f;
Meow() {
f.getDeclaringType() = this
}
Field getField() { result = f }
}
from Meow m
select m, m.getField(), m.getField()
My mental model of this is: "Meow is essentially a (struct, struct's field) tuple. from Meow m will select all of those tuples. For each of those , select m, m.getField(), m.getField() will print their contents."
But that is actually not what happens, because you get results like this:
| m | col1 | col2 |
+-----------------------------------+-----------------------------------------------------+-----------------------------------------------------+
// [snip]
| port_io_ops | f_inb | f_outb |
// [snip]
Which means that the first m.getField() and the second m.getField() are operating on different Meow objects.
I've been debugging a bug in my query for hours now only to realize that this is what happens. Is this really intended? I read through a non-trivial amount of documentation and did not realize this, I feel like my whole mental model of how codeql works is shattering :S
(If it is really intended, could the documentation be updated to point this out more clearly?)
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 129
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
false-positive
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
false-positive
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100