Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Addresses review feedback requesting test coverage for class instances created in inner scopes (se/enquanto) and assigned to outer-scope variables. This scenario is critical with ReferenciaMontao implementation, where incorrect deallocation on scope exit could invalidate valid references.

Tests Added

  • se block scope test: Verifies instance created inside conditional remains accessible after block exit
  • enquanto loop scope test: Verifies instance created inside loop remains accessible after iteration completes

Both tests confirm instance properties remain valid and accessible from the outer scope variable.

classe Produto {
  nome: texto
  preco: numero
  construtor(nome, preco) {
    isto.nome = nome
    isto.preco = preco
  }
}
var produto
se (verdadeiro) {
  produto = Produto("Notebook", 2500)
}
escreva(produto.nome)    // Should output: Notebook
escreva(produto.preco)   // Should output: 2500

💡 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.

Co-authored-by: leonelsanchesdasilva <53848829+leonelsanchesdasilva@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement feedback from PR #1096 for classes Add test coverage for class instance scope survival in conditional/loop blocks Feb 8, 2026
@leonelsanchesdasilva leonelsanchesdasilva marked this pull request as ready for review February 8, 2026 21:04
Base automatically changed from montao-classes to principal February 8, 2026 21:04
@leonelsanchesdasilva
Copy link
Contributor

@copilot Please rebase with principal.

@leonelsanchesdasilva leonelsanchesdasilva merged commit b50f6d9 into principal Feb 8, 2026
4 checks passed
@leonelsanchesdasilva leonelsanchesdasilva deleted the copilot/sub-pr-1096 branch February 8, 2026 21:17
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