From e0afa020540581ac4c239d96e92ab93a394bdaa3 Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Thu, 3 Apr 2025 18:50:51 +0200 Subject: [PATCH 1/2] Add exception about extension members in error about nullable receivers --- accepted/2.12/nnbd/feature-specification.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/accepted/2.12/nnbd/feature-specification.md b/accepted/2.12/nnbd/feature-specification.md index a23544235a..52990f58d9 100644 --- a/accepted/2.12/nnbd/feature-specification.md +++ b/accepted/2.12/nnbd/feature-specification.md @@ -6,6 +6,10 @@ Status: Draft ## CHANGELOG +2025.04.03 + - Add an exception for extension members in the error about nullable + receivers. + 2021.07.28 - Allow a constant factory constructor in a class with a late final instance variable. @@ -531,7 +535,7 @@ location outside of the statement. It is an error to call a method, setter, getter or operator on an expression whose type is potentially nullable and not `dynamic`, except for the methods, -setters, getters, and operators on `Object`. +setters, getters, and operators on `Object`, and except for extension members. It is an error to read a field or tear off a method from an expression whose type is potentially nullable and not `dynamic`, except for the methods and From 34a74ad832a98c5ad09c071f9156cee1ff6ffb74 Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Mon, 16 Jun 2025 17:42:21 +0200 Subject: [PATCH 2/2] Added exception for extension typed receivers --- accepted/2.12/nnbd/feature-specification.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/accepted/2.12/nnbd/feature-specification.md b/accepted/2.12/nnbd/feature-specification.md index 52990f58d9..6781de2d17 100644 --- a/accepted/2.12/nnbd/feature-specification.md +++ b/accepted/2.12/nnbd/feature-specification.md @@ -6,7 +6,7 @@ Status: Draft ## CHANGELOG -2025.04.03 +2025.06.16 - Add an exception for extension members in the error about nullable receivers. @@ -535,7 +535,8 @@ location outside of the statement. It is an error to call a method, setter, getter or operator on an expression whose type is potentially nullable and not `dynamic`, except for the methods, -setters, getters, and operators on `Object`, and except for extension members. +setters, getters, and operators on `Object`, and except when said member is an +extension member or the receiver type is an extension type. It is an error to read a field or tear off a method from an expression whose type is potentially nullable and not `dynamic`, except for the methods and