Skip to content

Extend AVR List/Map ban to class and struct field declarations#43

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-avr-class-field-bug
Draft

Extend AVR List/Map ban to class and struct field declarations#43
Copilot wants to merge 3 commits intomainfrom
copilot/fix-avr-class-field-bug

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

List and Map types are banned on AVR targets due to insufficient RAM. The ban applied to global variables but not to class or struct field declarations, creating an inconsistent loophole.

Changes

  • Class fields: Added AVR type checking in analyzeClassDeclaration() to validate propertyType against restricted collection types
  • Struct fields: Added AVR type checking in StructDeclaration case to validate field types against restricted collection types
  • Tests: Added 6 test cases covering List/Map restrictions in class/struct fields on both AVR (arduino_uno) and non-AVR (esp32) targets

Example

This now correctly fails on arduino_uno:

class DataLogger {
  mut List data  // ❌ Compilation error
  
  constructor() {
    self.data = new List()
  }
}

Error message matches existing global variable ban:

Collection type 'List' is not supported on AVR targets (arduino_uno) due to insufficient RAM.

Same validation applies to struct fields.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 15, 2026 16:00
Co-authored-by: ycharfi09 <203522567+ycharfi09@users.noreply.github.com>
Co-authored-by: ycharfi09 <203522567+ycharfi09@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Ypsilon Script to ban List and Map types in class fields on AVR Extend AVR List/Map ban to class and struct field declarations Feb 15, 2026
Copilot AI requested a review from ycharfi09 February 15, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments